Grab The Biggest Deal
of The Year

301 Redirect WordPress

301 Redirect WordPress

301 Redirects helps you manage and create 301, 302, 307 redirects for your WordPress site to improve SEO and visitor experience. With a user-friendly interface, 301 Redirects is easy to use. Perfect for new sites or repairing links after reorganizing your existing WordPress content, or when your site has content that expires and you wish to avoid sending visitors to a 404 error page. Use the 404 error log to identify problematic links and make redirection easy.

What is a URL Redirect?

A URL redirect is a way to remap a web page address. It’s quite similar to how the post office handles a change of address. You send your new address to the post office. Whenever someone sends you mail, the post office forwards the mail to the new address and lets the sender know of the new address.

The same thing happens on the web. The information is still there but on a new page. A WordPress URL redirect tells search engine web crawlers where that information has now been placed.

3 Types of Redirects

There are three basic types of redirects.

  • A 301 redirect is used when a web page has been permanently moved.
  • A 302 redirect is used for a temporary webpage move.
  • A meta refresh tells a browser to refresh a site after a given number of seconds.

A 301 Redirect is the Most Common Type and Signals a Page has Moved

Most redirects are 301’s. This redirect handles content moves to different pages and URLs on or off the site, perhaps even to a new website.

E-commerce sites use a lot of 301 redirects as they move products around to different parts of the website. For example, a new product might be featured on a page for new products. After a few weeks, it gets moved to another page where it’s featured with similar or complementary products. Finally, when a new version is about to be released, it might be moved to a sales page to clear it out of stock.

Several WordPress redirect plugins can simplify this process. These plugins will also work on WooComerce websites as well.

A 302 Redirect Indicates a Temporary Move

A 302 redirect is used for a few different reasons:

  • During page updates.
  • While conducting A/B tests of pages presenting the same information in different ways.
  • While clients or higher-ups are reviewing a page, you don’t want it to be included in your site’s search ranking.

Meta Refresh May Be Spam!

Most meta refreshes appear to be spam. These are the ones that say if you aren’t redirected within five seconds, click this link. If the website has good security, it will block the spam and load the information you were looking for.

Sometimes a business may want to use a meta refresh to explain that a familiar website has been changed, particularly if the company the website represents has been sold.

Why Implement a Redirect Command?

Redirect commands are necessary to tell search engines that a page has moved. Here are a couple of reasons this would happen:

  • A new domain name, common when a business is sold or otherwise undergoes a name change
  • Changing the organization on a website, common as a website site and business grow.
  • Redirects can also help search engines understand which page is the real “expert” source when several pages owned by the same entity have the same information.
  • If there’s been a typo in a printed ad campaign or email, a redirect on the accidental page solves the problem!

eCommerce sites often have pages with duplicate content, but only one page should be the one for search engines to recognize as the “expert” to list on search engine result pages (SERPs). That page should be identified as the “canonical” page. Usually, a 301 link is the right move, but sometimes a canonical link — similar to a 301 — works better for SEO purposes.

Or let’s say you’re running several advertisements using blogs, video, text messages, and other marketing techniques. A redirect from each of these sources to a single page where people can get more information, order a product or service, or otherwise answer the CTA makes it easier to track different ad campaigns’ effectiveness.

Finally, redirects are pretty much protected SEO. Having the proper link will have little to no impact on “link juice.” Link justice is the authority that the original page carries with search engines.

301 Redirects

wordpress-301-redirects-plugin

We already showed you the 301 Redirects plugin in the tutorial above, we’re just adding it again to remind you that it’s one of the top options for WordPress redirects.

Redirect Manager

Redirect Manager is a free redirect plugin from 10up, a well-known WordPress development agency. It offers a performance-boosting approach that stores your redirects as custom post types in WordPress.

You can choose from different redirect codes and even add your own status codes using a developer filter. You can also set up one-off redirects or use wildcards or Regex to set up broader redirects.

How To Set Up Server-Level Redirects

In addition to the one-off redirects that we’ve focused on so far, you also might have situations where you need to set up server-level redirects that affect every single URL on your site. The three most common scenarios here are:

  • HTTP to HTTPS – you can send all traffic to the HTTPS version of the content that a user requested.
  • non-www to www (or vice versa) – you can send all traffic to the www or non-www version of the content that a user requested.
  • Changing domain names – you can redirect all traffic to the old domain to the same piece of content on the new domain.

For example, with one rule, you can set it up so that:

  • Someone who visits http://youroldsite.com/post-a goes to https://yournewsite.com/post-a
  • Someone who visits http://youroldsite.com/post-b goes to https://yournewsite.com/post-b
  • Etc.

How To Redirect HTTP To HTTPS

To redirect all HTTP traffic to HTTPS, you can either use the .htaccess method that we showed you above or a dedicated plugin.

For the .htaccess method, you need to add the following snippet:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;

As for plugins, two good free options are:

How To Redirect WWW To Non-WWW (or Vice Versa)

To set up these redirects, you can use your site’s .htaccess file:

www to non-www:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yoursite.com [NC]
RewriteRule ^(.*)$ https://yoursite.com/$1 [L,R=301]

non-www to www:

RewriteEngine On
RewriteCond%{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301,NC]

How To Redirect an Entire Domain

To redirect your old domain to your new domain after changing domains, you can add the following .htaccess rule to your old site’s .htaccess file (not to your new site – you don’t need to add any rules on your new site):

#Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) https://newsite.com/$1 [R=301,L]

How to set up this permanent redirect:

  1. Log into your host and go to your dashboard to locate the cPanel.
  2. Click on the panel, and under Files, click on File Manager.
  3. Look for the .htaccess file and highlight it.
  4. Click on the “edit” command — you can’t actually open this file — or download it to Notepad and upload the file when you’re finished.

Here are the most common commands to use for redirects. Insert them before the last line in the file to redirect single pages:

  • Redirect 301 /old-page-here.html https://www.yournewwebsite.com/new-page-here.html

Use http:// if your site hasn’t migrated to SSL. If you’re redirecting the entire site to an SSL or to a new name, use this command:

  • Redirect 301 / https://www.yournewwebsitehere.com

Be sure to check with your host about the exact language. Some WordPress hosts use different commands, and at least one recommends using the WordPress config file for websites changing to SSL.

You can also program in 302 redirects this way — just be sure to remove them when you have completed your rewrites, internal review, or A/B testing and are ready to designate a permanent web page.

.htaccess files only work with Apache webserver software. Just about all WordPress sites use Apache, which is also an open-access product free to anyone who wants to use it and can be adapted to specific needs — just like WordPress.

Fix WordPress HTTP to HTTPS Redirect

WordPress will not automatically redirect HTTP requests to HTTPS unless you tell it to do so. If you are using a plugin like Really Simple SSL, then it would take care of redirects. Otherwise, you will have to manually set up redirects.

To set up HTTP to HTTPS redirect, you need to add the following code to your .htaccess file.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

We hope this article helped you fix some common issues with SSL / HTTPS on WordPress. If you run into an issue that’s not covered in this article, then please leave a comment to let us know. We will update the article with the solution. You may also want to see our ultimate WordPress security guide with step-by-step instructions for beginners to secure their WordPress websites.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Written by

William Jhonson

Leave a Reply

Your email address will not be published. Required fields are marked *