Redirect PHP: 301 Redirect in WordPress

Welcome to my Redirect PHP: 301 Redirect in WordPress article. 301 Redirect means to ‘Redirect Permanent’. If you decide to change the content of your web site or go to another project, you have to use 301 redirects.

That is, one URL address is permanently linked to another URL address. It tells search engines that the page has been completely moved to another URL address.

In most cases, 301 redirects are the best redirect method. Because it is the most ideal way in terms of SEO and user.

In this article I will try to explain why and how you need to do 301 redirect and how you can make 301 redirect .

Differences Between 301 Redirect  and 302 Redirect

301 redirect is the “permanent redirect” method as mentioned above, but 302 redirect is a temporary type (302 moved temporarily).

The 301 redirect method is used when the site is fully moved or when an internal link is used to complete our work. 301 redirects, most of the SEO values of the links are protected via 301 redirect

302 redirect is a temporary redirection in the same way we need to use for a site or link that will be temporarily disabled. We may use these temporary cases for renewal of our site, short maintenance due to technical reasons, or for a campaign or product which are past due. So visitors who visit our site or link will not face with 404 error page and it will not be worth the page. Google bots does not scan 302 redirected links.

Why Should We Use 301 Redirects?

301 redirects are used for content that is periodically targeted. Thus, without losing SEO score, one link will lead to another link. For example, you published a piece of content about 2015 Christmas discounts. Please link to this content “abc.com/2015-discounts”. For 2016, you will use this link to direct you to use SEO without losing your SEO score. Our new link was “abc.com/2016-discounts”. That is, we permanently redirect the link “abc.com/2015-discounts” to the link “abc.com/2016-discounts”.

There is also another important situation where 301 redirects are heavily used: 404 error pages. Always direct the 404 error pages to 301. Search engines like Google want you to direct 404 pages in particular. The search console even has a list of your 404 pages saved by Google bots. You should direct these pages without losing time.

Search Console Crawl Errors

Search Console – Crawl Errors

How to Redirect PHP and WordPress CMS – 301 Redirection at WordPress

You can redirect php with the following code ;

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newurl.com");
exit();
?>

Note: To use this code, simply paste in any page (to header) that you want to redirect with 301 code.

You can do 301 redirects in WordPress using htaccess file or plugin. We suggest you use the Redirection plugin. I think this plugin is a must. Who knows, perhaps in the future WordPress develops such a module.

You can review this article for more information about the redirection plugin and for the redirection plugin settings → Redirection Plugin and Settings

Leave a Reply

shares