I do not want index.html (or index.php, etc.) to show up in my URLs.
Use mod_rewrite to remove index.html from the URL. Enter the following into a .htaccess file :
RewriteCond %{REQUEST_URI} index\.html
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]
I do not want index.html (or index.php, etc.) to show up in my URLs.
Use mod_rewrite to remove index.html from the URL. Enter the following into a .htaccess file :
RewriteCond %{REQUEST_URI} index\.html
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]
How can I force my URL’s to have www at the front?
Use mod_write to force the www in the URL. Inside of a .htaccess file, add the following:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^your-domain\.com [NC]
RewriteRule (.*) http://www.your-domain.com/$1 [R=301,L]
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
Answer:
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.
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.