Idea is:

if      URL = "http:/localhost/site/"
else if URL = "http:/localhost/site"

redirect to


Can this be done with .htaccess / Apache mod_rewrite and how?

  • Yes, it can be done with mod_rewrite. – Marc B Jan 22 '12 at 6:48
  • 1
    Why aren't you using DirectoryIndex index.html? – Jon Lin Jan 22 '12 at 6:50

You could simple add this in your htaccess

DirectoryIndex index.html

| improve this answer | |
  • Why not the main Apache configuration file? Apache re-reads, re-parses, and re-configures whenever it discovers an .htaccess file in the directory structure. You might as well promote the mechanism that has the least impact... – sarnold Jan 24 '12 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy