Quote:
|
Originally Posted by greeneagle
mossop,
Was in the page header or a server side permanent 301 redirect?
Does anyone know what is preferred?
I also just saw another code snippet in another thread that claimed that it needed to be done that way in the header or it would be percieved as a 302 temporary redirect posted by T2DMan:
"You need to be very careful with how you do redirects
The correct coding for a 301 redirect is:
$url="http://domain.com";
Header("HTTP/1.1 301 Moved Permanently");
Header ( "Location: $url" );
Without the first header, the redirect becomes a 302 temporary redirect. If you use wording even slightly different, it can also become a 302 redirect."
This one is far from being resolved, can anyone shed more light?
Ken
|
I have recently used this particular php code snippet to redirect thousands of pages on some of my sites, due to modifying site structure. It worked just fine. 2-3 days after the change, Google came and mass loaded the new pages and all went fine afterwards.
If you are unsure if your 301 works fine, check it with a header viewer page. Like this one:
http://www.delorie.com/web/headers.html .
As a note, in my case the header shows: "HTTP/1.1 301 Undescribed" instead of "HTTP/1.1 301 Moved Permanently". However this is still a 301 and Google picked it up ok. I don't really know why it does that, used the code above Ken provided (server has IIS+PHP). But even with this issue, it worked for me.
Good luck!