Take the 2-minute tour ×

Is it possible to redirect my localhost/invoices directory to just invoices ? Perhaps by editing my hosts file?


share|improve this question
Your /etc/hosts file has nothing to do with directories. Are you talking about a web server? What are you trying to do? –  Brian Roach Mar 12 '11 at 18:41
add comment

1 Answer

I'm assuming that 'localhost' is currently set in the /etc/hosts file to your local IP address. Something like localhost

In which case, add invoices to this file localhost invoices

You will also need to modify the VirtualHost in the Apache config file (assuming you're using Apache) for that particular site:

   ServerName invoices
   DocumentRoot /path/to/new/directory

using the IP address of your server and the port you connect on. You will then need to reboot your web server.

The specifics will depend on your existing set up but hopefully this is enough to work with.

share|improve this answer
add comment

Your Answer


