PLEASE HELP! .htaccess redirect not working properly

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?

any and all help is greatly appreciated!

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.

the old domain htaccess looks like this:

(ignore the x in front of http on the first 3 lines as the forum will not let me submit a reply with “four links”… ridiculous)… thanks for your help!

RedirectMatch 301 .*/contact.cfm xhttp://new-domain.com/contact.php

RedirectMatch 301 .*/survey-form.cfm xhttp://new-domain.com/survey-form.php

RedirectMatch 301 (.*).cfm$ xhttp://www.new-domain.com$1.html

RedirectMatch 301 (.*).html$ http://www.new-domain.com$1.html

RedirectMatch 301 (.*).php$ http://www.new-domain.com$1.php

mg,

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.

Regards,

DK

could you please provide the syntax for the first line?

i used every technique that i could find and nothing that i used seemed to work…

if it still doesn’t work once i try your syntax then i will try to research the server config possibility.

thanks again!

Did you mean like this?:

RedirectMatch 301 .*/index.html http://new-domain.com

or with a forward slash at the end?
or some other syntax?

Sorry for the confusion but I’m just trying everything I can think of… thanks again, again…

anyone have any ideas?

fixed the problem.
thanks everyone for your help

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.