Our entire country experienced a complete internet shutdown for five days, which caused the delayed response.

Enjoy upto
80% OFF

301 Redirect WordPress

301 Redirect WordPress

301 Redirect helps you manage and create 301, 302, and 307 redirects for your WordPress site, improving SEO and visitor experience. 301 Redirects is easy to use with a user-friendly interface.

It’s 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.

What is redirect WordPress?

The most popular email content redirect manager for WordPress. It makes it simple to manage 301 redirects, monitor 404 issues, and generally take care of any remaining loose ends on your website. This might lower errors and raise the rating of your website. the WordPress admin menu and then click on ‘Website Redirect’.

What is a URL redirect?

A 301 redirect is a permanent redirect from one URL to another. It is a way to quickly let browsers know that the requested page or post has moved or been replaced.

Some other common redirects include:

  • 302 Found
  • 303 See Other
  • 304 Not Modified
  • 307 Temporary Redirect
  • 308 Permanent Redirect

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.

Several WordPress redirect plugins can simplify this process. These plugins will also work on email marketing best practices as well.

You’ll see four settings – here’s how to configure them:

  • Source URL – enter the original URL that you want to redirect. I.e. when someone visits this page, they’ll be redirected to a different page.
  • Query Parameters – leave this as the default.
  • Target URL – this is the new URL that you want to take visitors to. I.e. if someone visits the source URL, they’ll be taken to this URL.
  • Group – this just helps you organize your redirects. It’s fine to leave it as the default. Or, you can use the Groups tab to create a new group if you want to organize your different redirects.

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 is common as a website and businesses 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.

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.

Use .htaccess to add 301 redirect in WordPress

The most effective way to set up the 301 redirect for domain migration is using your WordPress site’s .htaccess file. Page-level redirection can also be set up using your .htaccess file, but this is less practical than using plugins.

1. Locate your .htaccess file

To modify the code in your site’s .htaccess file, first log in to your server’s cPanel dashboard and look for the File Manager.

Then, you can find the .htaccess file in the root folder of your site. You can also search for it by name:

2. Back up your .htaccess content

The next stage is really important. If not handled properly, the. htaccess file could impact how your website functions. Make sure you have a backup of the original by right-clicking the file name and choosing “Download” before making any changes.

3. Add the 301 redirection code

Choose the “.htaccess” file and choose “Edit” after saving the file to your computer. Alternatively, you can use the “Edit” option from the context menu when you right-click on the file. In the dialogue box that displays, select “Edit” to go to the following step.

How to setup 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:

  • Really Simple SSL
  • WP Force SSL & HTTPS SSL Redirect

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 an 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.

salonly
Golam Mostafa
Written by

Golam Mostafa

I'm a senior plugin developer for WordPress. I have four years of experience working as a software engineer for ADB Bank, and in 2018, I started developing plugins and founded ThemeDev.

Table of Content

Table of Contents

LTD Deals: 10+ Pro Plugins

Limited Time Offer
LTD Deals: 10+ Pro Plugins

Offer ends soon! Don't let it get away this time!

(NO RECURRING FEES)

Trusted by 25,099+ Customers

30 days Money Back Guarantee