Mobile app version of vmapp.org
Login or Join
Cofer257

: Redirect page to symlink So I have 2 URLs that basically link to the main url using a symlink maindomain.com englishdomain.com -> symlink to maindomain.com frenchdomain.com - >

@Cofer257

Posted in: #Google #Php #Redirects

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

maindomain.com
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

$url = "http://" . $_SERVER['HTTP_HOST'];

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


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

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Cofer257

2 Comments

Sorted by latest first Latest Oldest Best

 

@Lengel546

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.

10% popularity Vote Up Vote Down


 

@Alves908

According to php.net/manual/en/function.header.php the header('Location: www.example.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 example1.com to example2.com.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme