Simple mod_rewrite

I’ve got a site on DH that’s been using index.html as it’s homepage for some time now. I’d like to change it over to use index.php and still allow people who have bookmarked the index.html page to have the site automatically load the new index.php homepage. I’d rather not use the HTML redirect technique.

I’ve been trying to get mod_rewrite to work and have tried the example (and various permutations) of what I found on the DH wiki:

What I have found is that if I include the “Options +FollowSymLinks” line that the site comes up “500 Internal Error”.

If the .htaccess file contains just this:

RewriteEngine On
RewriteRule ^index.html$ /index.php

Then I just get the old index.html page. I suspect it’s something simple but I can’t seem to figure this one out.

Using a .htaccess 301 will preserve any search engine rankings :wink:

redirect 301 /index.html

Maximum Cash Discount on any plan with MAXCASH

Thanks for the input but when I put the .htaccess file that contains this:

RewriteEngine On
redirect 301 /index.html

Into the root directory for that site and I still get the old index.html home page coming up.

The RewriteEngine On line is unnecessary.

Maximum Cash Discount on any plan with MAXCASH

Not only unnecessary, but detrimental :wink:

It’s working perfectly now, thanks for the help.

haha yes, a more apt term indeed.

Glad you have it sorted :wink:

Maximum Cash Discount on any plan with MAXCASH

Just for curiosity, would the following provide the same results?

‘RewriteRule ^(.*).htm$ $1.php’


RewriteRule ^(.*).html$ $1.php [R=301,L]

But that would require the OP to convert all htm/html files to php.

If you want to mix & match you could probably allow html through the interpreter and keep the html extension on your php files.

AddType application/x-httpd-php htm html php
AddHandler application/x-httpd-php .htm .html

I’ve never tried this though :s

Maximum Cash Discount on any plan with MAXCASH