I'm working on a site locally that's just sitting in a folder:
How can I route, with Apache2, that to be like:
Or just something so it's not a sub directory? It's making local development very frustrating.
Let me add some points to In Protest's answer.
1). enable the apache userdir module.
this will enable apache userdir module. Now you can put the contents of website in
Note: The default folder is
2). Make necessary changes to
3). Restart the apache
Now you can access the site by navigating your browser to http://ip-address/~username.
4) Set a virtual host for this site as in In Protest'answer
If you are looking to run php files you need to do one more step
Then restart the apache.
Thats it. You are done.
Hope this helps. If you face any difficulties feel free to post it here.
You need to do two things, the first is to make an apache2 virtual host that will respond to the domain name given and the port used; so in
Once you have that part you can restart your apache2 server. Next you have to enable a localhost hostname, to do this you edit the file
This effectively adds the