.htaccess nightmare - help

software development

#1

I have been having problems setting up a good .htaccess redirect since moving from windows server to dreamhost.

I have .com and .co.uk and would like to .co.uk to 301 redirect to the .com

I think all the control panel directs are 302

the .co.uk is currently on a control panel point to the .com

Anyone got a better way???

Also had to change all my old pages over to .phtml

So need to 301 redirect all .html and .asp to new extension of .phtml.

This didnt work

RewriteEngine ON
RewriteRule ^(.*)$ http://www.mypage.com/$1 [R=301,L]

(Redirection for this url exceeded)
is the error message

This one does work

RedirectMatch 301 (.).html$ http://www.mypage.com$1.phtml
RedirectMatch 301 (.
).asp$ http://www.mypage.com$1.phtml

It covers the html, asp to phtml thing

BUT it doesnt allow any http://www.mypage.com

it converts to http://www.mypage.com/index.phtml

so this means EVERYTHING even http://www.mypage.com gets 301.

(I think this is not so good for my root and for all prior google links (why is www.mypage.com treated different that www.mypage.com/index.phtml ?)

#--------
Does anyone have a script that sends all 404 errors through a redirect to http://www.mypage.com

Errordocument 404 http://www.mypage.com used to work but not since I set up a database as it did something to the php and cgi not sure what?

It would be best to allow http://www.mypage.com to stay as it is (no automatic change to mypage.com/index.phtml) and does the .html & .asp transfer to corresponding pages in .phtml

#--------
With all these functions covered it would be perfect!

Hoping for help!

www.martialarm.com
The New Way To Train!


#2

Maybe I am mis reading your thread. But have your tried to just use a meta redirect. You can create a page on the .co.uk site that explains to the user that they will get redirected to the .com site or visa versa.
I was explaining this to another user awhile back at this link
http://discussion.dreamhost.com/showflat.pl?Cat=&Board=forum_programming&Number=26647&page=3&view=collapsed&sb=5&o=14&part=

Silk