Page 1 of 1

My 302 just doesn't want to know...

Posted: Tue Oct 31, 2006 12:20 pm
by tossedsalad
Hi!

I'm in the process of moving from a .com (currently hosted at location:A) to a .co.uk (currently hosted in location:B)

The plan is eventually to only host at location:B, probably in a month's time.

The .co.uk is waiting to be indexed currently (sandbox, I guess), meantime I've tried issuing a 302 redirect (from location:A to location:B), with the following code:

Code: Select all

<IfModule mod_rewrite.c>
	Options +FollowSymlinks
        RewriteEngine on
        RewriteCond %{HTTP_HOST] ^(www\.)?mydomain\.com [NC]
        RewriteRule ^(.*) http://www.mydomain.co.uk/ [R=302,L]
</IfModule>
But nothing happens.

Any thoughts?

David

Re: My 302 just doesn't want to know...

Posted: Tue Oct 31, 2006 12:35 pm
by tsw
most probably its in rewritecond clause which you wont probably even need as everything gets redirected.

I think this might be a better variation

RewriteCond %{HTTP_HOST} !^www.mydomain.co.uk$ [NC]
RewriteRule ^(.*)$ www.mydomain.co.uk/$1 [R=302,L]

so everything not www.mydomain.co.uk would be redirected.

like www.domain.com/foo.html&nbsp; --> www.mydomain.co.ul/foo.html

(untested tho ;)

Re: My 302 just doesn't want to know...

Posted: Tue Oct 31, 2006 1:03 pm
by tossedsalad
I'm afraid that didn't work.  Firefox said that it was redirecting in a way that would "never complete"

Re: My 302 just doesn't want to know...

Posted: Tue Oct 31, 2006 1:55 pm
by tsw
where are you setting that rewrite?

if you want the .com to be redirected to co.uk you need to set the redirectation in .com server, and as those are different servers (as stated in the first post) only thing co.uk server knows is that the client has bee redirected from .com server.

Re: My 302 just doesn't want to know...

Posted: Tue Oct 31, 2006 2:10 pm
by tossedsalad
Naturally, it's on the .com server

Re: My 302 just doesn't want to know...

Posted: Fri Nov 03, 2006 10:29 pm
by Pierre M.
Shouldn't we read 301 (permanently moved) rather than 302 (temporarily moved) ? Or is it me who is confused ?

Set a static page at B : ...domain.co.uk/page.html
Try it directly. Then issue an hard redirect just for it at A :
RewriteRule ^/old.cfm$ ...domain.co.uk/page.html [R=301,L] (as tsw wrote)
Does it work ? Then try :
wget http://...domain.com/old.cfm
(man wget to see how to activate verbose output)

PM