Take the 2-minute tour ×

So I have 2 URLs that basically link to the main url using a symlink

 englishdomain.com -> symlink to maindomain.com  
 frenchdomain.com - > symlink to maindomain.com/fr 

When someone actually lands on maindomain.com/index.php it will automatically redirect them to the appropriate symlink

The problem I'm having is I think it's affecting my google ranking and I'm not sure why..

this is my redirect code


if ( $url == 'http://www.maindomain.com' || $url == 'http://maindomain.com') {
    header('Location: http://www.englishdomain.com/');
if ( $url == 'http://www.frenchdomain.com' || $url == 'http://frenchdomain.com') {
    header('Location: http://www.frenchdomain.com/fr');

Is it possible that it's affecting my google ranking?

share|improve this question
Using PHP to perform the redirect is marginally slower than using mod_rewrite - is there a reason you are avoiding mod_rewrite? –  danlefree Sep 22 '10 at 1:57
Would using mod_rewrite affect my ranking or google analytics for that matter or is it simply the same result just faster? –  Serge Sep 22 '10 at 19:57
Same result just faster: Google Analytics relies on a Javascript call which won't be triggered if you redirect using mod_rewrite or PHP and your server logs will continue to show the redirects occurring. –  danlefree Sep 22 '10 at 22:55
add comment

2 Answers

up vote 4 down vote accepted

Acording to http://php.net/manual/en/function.header.php the header('Location: http://www.englishdomain.com/') command will send a 302 redirect to the client.

You should use a 301 redirect if you want to 'transfer' the SEO Gold on maindomain.com to englishdomain.com.

More info on the 301 and 302 diff here: http://www.bigoakinc.com/blog/when-to-use-a-301-vs-302-redirect/

share|improve this answer
I believe you have the right answer but I have yet to see any difference. I'm also running a google adwords campaign as well as several ads placed on ad networks and I have yet to see any of those websites in a search result (except of course for the sponsored ad) Even a search for link:englishdomain.com yields no result –  Serge Sep 22 '10 at 19:58
well it's finally starting to show up in results even though webmaster tools doesn't show any information about the links –  Serge Sep 29 '10 at 22:49
add comment

In addition to mawtex' answer (which I believe is correct):

// 301 Moved Permanently
header("Location: /foo.php",TRUE,301);

...should do the trick. But please test this thoroughly.

share|improve this answer
add comment

Your Answer


