0

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

pixelngrain
  • 349
  • 2
  • 3
  • 17
  • 1
    Latest apache version has change in some way. Try this one http://askubuntu.com/questions/423514/how-to-enable-mod-rewrite-for-virtual-host/423589#423589 – Nabil Feb 24 '14 at 12:37
  • Cool resolved.... can you please tell me how can I learn all apache stuffs? – pixelngrain Feb 24 '14 at 12:42
  • This is apache official documentation - http://httpd.apache.org/docs/current/howto/htaccess.html .. But this is more interesting and I learned a lot from here - http://htaccess-guide.com/ – Nabil Feb 24 '14 at 12:44

1 Answers1

0

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

https://www.linode.com/wiki/index.php/Configure_apache_to_use_virtual_hosts_on_ubuntu_server

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.

https://lists.debian.org/debian-devel/2013/07/msg00809.html

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.

versvs
  • 280
  • 2
  • 9