Forum Moderators: coopster

Message Too Old, No Replies

find redirected url

         

muraligaru1

8:02 am on Dec 15, 2009 (gmt 0)

10+ Year Member



my website moved from www.site1.com to www.site2.com.
yahoo automatically redirecting to site2.com from site1.com using 301 redirect.

What is the problem is.. they are redirecting all site1.com/* pages to root
of site2.com. It is not getting redirected to particular page.

when i contacted with yahoo webhosting service. they said. they are not supporting it.

Is there any way for me, to get site1.com/* url from site2.com.

When control came to site2.com... how can i know, from which url it got redirected?

ALKateb

10:35 am on Dec 15, 2009 (gmt 0)

10+ Year Member



if they will not support this i suggest you to attach site1.com to a web hosting account and do this redirection with php like this:

header("location: [site2.com"...] . $_SERVER['PHP_SELF']);

there might be another way! u might want other answers

TheMadScientist

10:53 pm on Dec 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I would actually suggest using the following, because the preceding will not serve a 301 redirect, but rather 302 'undefined'...

header("HTTP/1.1 Moved Permanently");
header("location: http://www.example.com" . $_SERVER['REQUEST_URI']);

I switched to REQUEST_URI in case there is any type of rewrite or anything, because it will be the URL in the browser address bar, where PHP_SELF may not.

TheMadScientist

9:50 am on Dec 16, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Of course if I type what I was thinking mine would work better too...

header("HTTP/1.1 301 Moved Permanently");

...That's one of the reasons why you should always test using a header check like the one here in your control panel.
Sometimes my fingers forget to do all the talking they should. ;)