Redirect page to symlink

Redirect page to symlink - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Redirect page to symlink error on your web browser. Problem :


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: 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?


Solution :

According to http://php.net/manual/en/function.header.php the header('Location: http://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.



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.


We hope that this article has helped you resolve the google, php, redirects error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=