Hello Guys,
In this Blog, we are going to discuss How to redirect URL with the help of Php language. If you want simpler method like Html redirection for this you can visit my previous blog How to Redirect a Website using HTML Code.
Php Code for redirection:
Php code redirection is pretty easy, it uses Header Function for redirection. Proper Page redirection is one of the most vital On-Page SEO Factor.
One must be noted that your website is PHP enable. You have to paste the below code on the top part of your file before all type of Meta Tags or text so that your visitor can redirect to another web page.
Temporarily Redirect via PHP
<?php header('Location: http://www.new-URL.com'); exit; ?>
By default it moves temporarily(302). Which means it is moved temporarily and does not gives any link juice to new website page. So for SEO point of view we should use permanent move(301 redirection)
Permanent Redirect via PHP:
<?php header('Location: http://www.new-URL.com/', true, 301); exit();
?>
True will replace any existing set header and 301 will tell Browser and Crawler that this is a permanent redirection.
Permanent redirection is the best redirection as far as SEO/ Digital Marketing is concern because it passes approximately 90% of Link Juice from old Website to new website. The optional true parameter above will replace a previously set header (if any) and the 301 at the end will change the response code to the right one.
Hope you like this Blog post on Php redirection as SEO Expert point of view, If you have any query regarding this blog or any other Php language query, feel free to post on FindNerd's Php questions and answers Link.
0 Comment(s)