Create a URL Redirect in WordPress Website

URL Redirect

Create a URL Redirect

How To URL Redirect, Diverting guests starting with one page on your site then onto the next is a significant piece of site support and there could be various explanations behind doing it. Investigate them all, and figure out how to make diverts on your WordPress site

Sooner or later in the existence of your WordPress site, you will have to set up diverts with the goal that you can send guests starting with one area on your site then onto the next area. Hence, get what sidetracks are, what you can utilize them for, and how to set them up on your site.

In this post, we’ll cover those themes and tell you the best way to make your first divert either utilizing your own code or through a free WordPress module.

This is a fundamental device to have in your WordPress tool stash. So in case you’re curious about diverts, continue perusing to learn all that you want to know.

What Is a URL Redirect?

A URL divert allows you to send guests/bots starting with one URL on your site then onto the next URL on your site.

For instance, suppose you composed a blog entry at yoursite.com/best-modules 2020 and presently you need to transform it to yoursite.com/best-modules 2021. With a URL divert, you can set it up so any individual who visits yoursite.com/best-modules 2020 gets consequently shipped off yoursite.com/best-modules 2021.

This assists you with giving a superior encounter to your human guests by ensuring they’re generally ready to get to the substance that they’re searching for. For instance, rather than seeing a 404 blunder page on the off chance that they visited the best-modules 2020 URL, they would in any case have the option to get to the most recent substance since they naturally get diverted to best-modules 2021.

Diverts are likewise significant for website improvement (SEO) in light of the fact that they let you save your rankings and connections. For instance, suppose you got a ton of connections from different destinations to your best-modules 2020 post (which is useful for SEO). On the off chance that you didn’t set up a divert, you would lose a significant part of the advantage of those connections when you changed the URL. In any case, with a divert, you can save that connect expert for the new URL.

What Can You Use URL Redirects For?

  • Change a piece of content’s URL – at whatever point you change the URL of a post or page on your WordPress site, you should set up a divert to keep away from 404 mistakes and augment SEO.
  • Fix broken substance – assuming you see a great deal of 404 blunders to a specific URL on your site, you can set up a divert to send those guests directly to the substance that they’re searching for.
  • Change your site’s area name – in case you at any point change your WordPress site’s space name (during a site movement, for instance), you ought to consistently set up a divert so that guests to the old area get shipped off the enhanced one.
  • Move from HTTP to HTTPS – when you introduce an SSL/TLS authentication, you should set up a divert to ensure that all guests utilize the safer HTTPS adaptation of your site rather than HTTP.
  • Power www or non-www – on the off chance that you incline toward www.yoursite.com versus yoursite.com, you can set up a divert to drive all guests to utilize the www rendition (or the other way around).
  • Make pretty connections – sidetracks can assist you with making prettier inside or outer connections. For instance, a great deal of member locales shrouds their connections (yoursite.com/go/subsidiary proposition). This strategy depends on diverts. Or on the other hand, interface shortening administrations like bit.ly additionally work through diverts.

Different Types of URL Redirects and When You Should Use Them

  • To add a little intricacy, there are various sorts of sidetracks, each joined by a mathematical code. All sidetracks work something similar (sending traffic starting with one spot then onto the next), yet the mathematical code serves to convey extra data about the divert to clients’ internet browsers and web indexes like Google:
  • 301 Moved Permanently – this code demonstrates that the divert is extremely durable. All the more explicitly, the substance being referred to is not generally situated at the first URL and is forever moved to the new URL. This is the most widely recognized kind of divert and it’s significant for SEO in light of the fact that it allows you an opportunity to pass the “authority” from the first URL to the new URL.
  • 302 Found (Temporary Redirect) – this code demonstrates that the divert is impermanent. At the end of the day, the substance actually exists at the first URL, yet clients are briefly being shipped off another page. You will not utilize this code that frequently – it’s basically just valuable for things like A/B testing, upkeep, or geotargeting. You ought to never utilize 302 sidetracks for SEO purposes.
  • 303 See Other – this is basically the same as a 302 divert. The key contrast is that it prevents clients from submitting data at least a couple of times (for example their Visa subtleties). In more specialized subtleties, it prevents the client’s program from making one more PUT demand and advises it to utilize GET for resulting demands.
  • 307 Temporary Redirect – likewise basically the same as 302/303 sidetracks. Once more, the main contrast is in the specialized subtleties – a 307 divert utilizes a similar strategy to send and get data while the 303 divert utilizes two unique methods.
  • 308 Permanent Redirect – this is like the 301 divert in that it implies the substance has for all time been moved. The thing that matters is in the specialized subtleties – a 308 divert can just utilize POST, while a 301 divert can change from POST to GET.

As a WordPress client, you’ll quite often utilize 301 sidetracks to forever divert content, While different sorts of sidetracks are as yet valuable for engineers in the specialty situations that we referenced, most normal clients will just at any point need to work with 301 sidetracks.

What’s more, once more, for SEO purposes, you’ll likewise quite often need to utilize 301 sidetracks.

How To Create a URL Redirect in WordPress Using .htaccess

On the off chance that your web has utilized the Apache webserver (which most WordPress has done, barring some famous oversaw suppliers like Kinsta or Flywheel), you can set up diverts by altering your website’s .htaccess record.

Note – some oversaw WordPress has utilized the Nginx web server, which doesn’t uphold .htaccess documents. On the off chance that you can’t track down your site’s .htaccess document, you should contact your host’s help to ask them how to continue. Some Nginx-based hosts have assembled their own divert instruments.

Accepting your host has .htaccess documents, here’s the manner by which to do it:

1. Find Your Site’s .htaccess File

To get to your site’s .htaccess document, you’ll have the option to interface with your site’s server through FTP or a device like cPanel File Manager.

Whenever you’ve done that, you should see your .htaccess document in your site’s root organizer, which is the very envelope that contains the wp-administrator and wp-content envelopes.

Some WordPress SEO modules likewise offer in-dashboard .htaccess editors. For instance, on the off chance that you’re utilizing Yoast SEO, you can go to SEO → Tools → File Editor to alter your .htaccess record.

2. Make a Backup of Your .htaccess File

Sidetracks can be precarious and one little slip-up can bring about a few or all of your sites becoming distant. Hence, it’s fundamental that you back up your current. htaccess record prior to rolling out any improvements. You can do this by downloading it to your nearby PC.

That way, assuming something turns out badly, all you really want to do is re-transfer your reinforcement duplicate and your site will immediately return to typical.

3. Add Your Redirects

Whenever you’ve downloaded a reinforcement of your current. htaccess record, you’re prepared to add your sidetracks utilizing code, which you can add close to the highest point of your .htaccess document.

Try to supplant the placeholder URLs with the genuine URLs that you need to utilize:

Divert 301/old-post https://www.yoursite.com/new-post

This code scrap diverts guests to https://www.yoursite.com/old-post to https://www.yoursite.com/new-post.

Note that, for the URL that triggers the divert, you just need to enter the part that comes after your area name.

Later on, we’ll share some other more convoluted kinds of sidetracks, such as diverting a whole space name after you change areas.

How To Redirect a URL With a WordPress Plugin

In case you would rather not work straightforwardly with your site’s .htaccess record, a less difficult choice is to utilize a WordPress redirection module. These modules let you make and deal with your site’s sidetracks directly from your WordPress dashboard.

There are a few quality choices, which we’ll examine in the following area. In any case, in this part, we’ll tell you the best way to set up a divert utilizing quite possibly the most famous option – the free 301 Redirects module. Notwithstanding the name, the module can assist you with making different sorts of sidetracks past 301s, including 302 and 307 sidetracks.

When you introduce and actuate the module, you can go to Settings → 301 Redirects to begin adding diverts.

Here, you’ll see a table with three choices:

  • You can utilize the drop-down to pick the divert type, which is 301 as a matter of course.
  • In the Redirect From field, you can enter the URL that you need to trigger the divert. For instance, to trigger a divert on yoursite.com/best-modules 2020, you would enter best-modules 2020 in the container.
  • In the Redirect To field, you can pick where you need to send guests to. You can either pick an existing substance on your site or enter any custom URL.
  • Whenever you’ve added the data, click Save and you are diverting will be live:

url redirect

  • You can repeat the process to create additional redirects.

Best WordPress Redirect Plugins

Here are some of the best plugins to help you create WordPress redirects…


Redirection is the most popular WordPress redirect plugin at WordPress.org, where it’s active on over one million sites.

It has a much larger feature list than the 301 Redirects plugin that we showed you in the tutorial above, which can make it a better option in some situations.

For example, it can automatically set up redirects if you change a URL on your site and it also lets you use Regex to set up more complicated types of redirects.

However, if you just want a simple solution to redirect a few URLs, it might be a little overkill for your needs. That’s why we chose to showcase the 301 Redirects plugin.

301 Redirects

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.

Safe Redirect Manager

url redirect

Safe Redirect Manager is a free divert module from 10up, a notable WordPress improvement organization. It offers a presentation supporting methodology that stores your sidetracks as custom post sorts in WordPress.

You can browse diverse divert codes and even add your own status codes utilizing a designer channel. You can likewise set up one-off sidetracks or use trump cards or Regex to set up more extensive sidetracks.

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]

Start Using WordPress Redirects Today and Improve Your Website

It’s important to understand how to use redirects so that you can offer your human visitors a good experience and also maximize your SEO efforts.

In most situations when creating a blog or a website, you’ll only need to work with 301 redirects, but the other types of redirects also have their own niche use cases (though mainly only for developers).

To set up redirects, you can use your site’s .htaccess file (if your host’s web server is Apache) or one of the WordPress redirect plugins that we detailed.

Leave a comment

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