Hide index.html from URL in address bar

Question: I want users to my site to always go to the base URL http://site.com/ – I never want the index page to show. For example, I want http://site.com/index.html to redirect automatically to http://site.com without the index.html


Create a .htaccess file (or add to your existing .htaccess) in the top level directory for your site and add the following line:

RewriteEngine on

RewriteRule ^index\.html$ / [R=301,L]

The line :

RewriteEngine on

may already be in your existing .htaccess. If so, do not duplicate it.

Do you support mod_rewrite?

Yes, mod_rewrite is fully supported. mod_rewrite is a great apache module and we are happy to allow its use.

You can enter mod_rewrite rules into a standard .htaccess file. The rules will have effect over all files in that directory and in all directories “below” that directory.

Please note that due to the complex nature of mod_rewrite rules, we are not able to offer debugging assistance with your rules.