New to Ubuntu and trying to set-up PHP environment. Now most of the things are set but .htaccess file not working at all for my CMS.

I have two sites /var/www/one/ and /var/www/two/ now when I hit http://localhost/ it is showing me two directories.

Now when I tried to set .htacces to rewrite the URL it is giving me page not found error. I have tried many things but nothing work. Eventually I found this https://askubuntu.com/a/48363/249945 and when I tried it is giving me Internal Server Error for the site one which has .htaccess file.

Please help me to make it work.. Million.. trillion thanks... :)

Forgot to mention when I try to use above answer solution it is hiding my one directory if I access http://localhost/ and showing only directory two


Though in comments you said that the proposed workaround solved your issue, I wonder if you have tried to create two different virtual hosts for Apache, so that you can access every folder through different .local domains.

For how to create an vhost, this linode guide seems pretty straight-forward


For how to add any .local domains to your hosts file you can edit /etc/hosts using gedit or any text editor of your choice.

This post to a Debian mail list a few months ago should guide you to get this working.


In this way you will set up a more organized developing environment in your local machine. You may still need mod_rewrite if the webapps/websites you are building require it, but not to prevent the localhost/one/ ugly url issue.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.