didn’t know where to post this…
I am having trouble getting .htaccess to work. Here is the situation that I am encountering:
redirecting .CFM pages from old domain to new .HTML pages on new domain → works fine
redirecting .HTML pages from same old domain to same new domain → works fine
but the redirect from old-domain.net to new-domain.com ends up at new-domain.com/index.html
(i want to arrive at new-domain.com/)
(obviously i cannot just redirect the entire domain because the CFM pages are now HTML pages)
i have tried everything that i can think of in the .htaccess file on the old domain
i even tried putting an .htaccess file on the NEW domain with the following code: RewriteEngine On RewriteRule ^index\.html$ http://new-domain.com/ [L,R=301]
(but this didn’t work either)
any ideas?
As best as I can guess, something on your new domain redirects root to index.html. But actually there’s a problem with that guess, because if that were true, then your new domain htaccess would have caused an infinite loop. So really I think there just isn’t enough information to diagnose this issue. If you could show your old domain htaccess, that’d be a good place to start.
It’s the ordering of your code which appears to be the problem. Add a Redirect statement before your generic redirects to send index.html to the new domain without specifying the DirectoryIndex.
Since it is possible for a host to require Apache to specify the link to the DirectoryIndex, if index.html still appears, contact your host and see about this configuration issue. Personally, I have no issue with the server identifying the DirectoryIndex file but that’s just me. I would rather hide the file extension and use mod_rewrite (in the new domain) to test whether which extension matches the filename (you can’t duplicate those or the first matched will always be the one seved) and redirect accordingly. Your situation is a little more complex with multiple extensions but that makes little matter to mod_rewrite.