At some point in the life of your WordPress site, you’re going to need to set up redirects so that you can send visitors from one location on your site to another location. For that reason, it’s important to understand what redirects are, what you can use them for, and how to set them up on your site.

In this post, we’ll cover all of those topics and show you how to create your first redirect either using your own code or via a free WordPress plugin.

This is an essential tool to have in your WordPress toolbox. So if you aren’t familiar with redirects, keep reading to learn everything that you need to know.

Table of Contents

What Is a URL Redirect?

A URL redirect lets you send visitors/bots from one URL on your site to another URL on your site.

For example, let’s say you wrote a blog post at and now you want to change it to With a URL redirect, you can set it up so that anyone who visits gets automatically sent to

This helps you provide a better experience for your human visitors by making sure they’re always able to access the content that they’re looking for. For example, instead of seeing a 404 error page if they visited the best-plugins-2020 URL, they would still be able to access the latest content because they automatically get redirected to best-plugins-2021.

Redirects are also important for search engine optimization (SEO) because they let you preserve your rankings and links. For example, let’s say you got a lot of links from other sites to your best-plugins-2020 post (which is good for SEO). If you didn’t set up a redirect, you would lose much of the benefit of those links when you changed the URL. But with a redirect, you can preserve that link authority for the new URL.

What Can You Use URL Redirects For?

  • Change a piece of content’s URL – whenever you change the URL of a post or page on your WordPress site, you should set up a redirect to avoid 404 errors and maximize SEO.
  • Fix broken content – if you see a lot of 404 errors to a certain URL on your site, you can set up a redirect to send those visitors straight to the content that they’re looking for.
  • Change your site’s domain name – if you ever change your WordPress site’s domain name (during a site migration, for example), you should always set up a redirect so that visitors to the old domain get sent to the new one.
  • Move from HTTP to HTTPS – when you install an SSL/TLS certificate, you should set up a redirect to make sure that all visitors use the more secure HTTPS version of your site instead of HTTP.
  • Force www or non-www – if you prefer vs, you can set up a redirect to force all visitors to use the www version (or vice versa).
  • Create pretty links – redirects can help you create prettier internal or external links. For example, a lot of affiliate sites cloak their links ( This tactic is based on redirects. Or, link shortening services like also operate via redirects.

Different Types of URL Redirects and When You Should Use Them

To add a little complication, there are different types of redirects, each accompanied by a numerical code. All redirects function the same (sending traffic from one place to another), but the numerical code serves to communicate additional information about the redirect to users’ web browsers and search engines like Google:

  • 301 Moved Permanently – this code indicates that the redirect is permanent. More specifically, the content in question is no longer located at the original URL and is permanently moved to the new URL. This is the most common type of redirect and it’s important for SEO because it gives you a chance to pass the “authority” from the original URL to the new URL.
  • 302 Found (Temporary Redirect) – this code indicates that the redirect is temporary. In other words, the content still exists at the original URL, but users are temporarily being sent to another page. You won’t use this code that often – it’s mainly only useful for things like A/B testing, maintenance, or geotargeting. You should never use 302 redirects for SEO purposes.
  • 303 See Other – this is very similar to a 302 redirect. The key difference is that it stops users from submitting information more than once (e.g. their credit card details). In more technical details, it stops the user’s browser from making another PUT request and tells it to use GET for subsequent requests.
  • 307 Temporary Redirect – also very similar to 302/303 redirects. Again, the only difference is in the technical details – a 307 redirect uses the same technique to send and get information while the 303 redirect uses two different techniques.
  • 308 Permanent Redirect – this is similar to the 301 redirect in that it means the content has permanently been moved. The difference is in the technical details – a 308 redirect can only use POST, while a 301 redirect can change from POST to GET.

As a WordPress user, you’ll almost always use 301 redirects to permanently redirect content, While the other types of redirects are still useful for developers in the niche scenarios that we mentioned, most average users will only ever need to work with 301 redirects. 

And again, for SEO purposes, you’ll also almost always want to use 301 redirects.

How To Create a URL Redirect in WordPress Using .htaccess

If your web host uses the Apache web server (which most WordPress hosts do, excluding some popular managed providers such as Kinsta or Flywheel), you can set up redirects by editing your site’s .htaccess file.

Note – some managed WordPress hosts use the Nginx web server, which doesn’t support .htaccess files. If you can’t find your site’s .htaccess file, you might want to reach out to your host’s support to ask them how to proceed. Some Nginx-based hosts have built their own redirect tools.

Assuming your host does have .htaccess files, here’s how to do it:

1. Locate Your Site's .htaccess File

To access your site’s .htaccess file, you’ll need to be able to connect to your site’s server via FTP or a tool like cPanel File Manager.

Once you’ve done that, you should find your .htaccess file in your site’s root folder, which is the same folder that contains the wp-admin and wp-content folders.

Some WordPress SEO plugins also offer in-dashboard .htaccess editors. For example, if you’re using Yoast SEO, you can go to SEO → Tools → File Editor to edit your .htaccess file.

2. Make a Backup of Your .htaccess File

Redirects can be tricky and one small mistake can result in some or all of your site becoming inaccessible. For that reason, it’s essential that you back up your existing .htaccess file before making any changes. You can do this by downloading it to your local computer.

That way, if something goes wrong, all you need to do is re-upload your backup copy and your site will instantly go back to normal.

3. Add Your Redirects

Once you’ve downloaded a backup of your existing .htaccess file, you’re ready to add your redirects using code, which you can add near the top of your .htaccess file.

Make sure to replace the placeholder URLs with the actual URLs that you want to use:

Redirect 301 /old-post

This code snippet redirects visitors to to

Note that, for the URL that triggers the redirect, you only need to enter the part that comes after your domain name.

Later on, we’ll share some other more complicated types of redirects, like redirecting an entire domain name after you change domains.

How To Redirect a URL With a WordPress Plugin

If you don’t want to work directly with your site’s .htaccess file, a simpler option is to use a WordPress redirection plugin. These plugins let you create and manage your site’s redirects right from your WordPress dashboard.

There are several quality options, which we’ll discuss in the next section. However, in this section, we’ll show you how to set up a redirect using one of the most popular options – the free 301 Redirects plugin. Despite the name, the plugin can help you create other types of redirects beyond 301s, including 302 and 307 redirects.

Once you install and activate the plugin, you can go to Settings → 301 Redirects to start adding redirects.

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

  1. You can use the drop-down to choose the redirect type, which is 301 by default.
  2. In the Redirect From field, you can enter the URL that you want to trigger the redirect. For example, to trigger a redirect on, you would enter best-plugins-2020 in the box.
  3. In the Redirect To field, you can choose where you want to send visitors to. You can either choose existing content on your site or enter any custom URL.

Once you’ve added the information, click Save and your redirect will be live:


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, 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


Safe 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 goes to
  • Someone who visits goes to
  • 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} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

non-www to www:

					RewriteEngine On
RewriteCond%{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$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 (.*)$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.

Still, have any questions about how to use redirects on WordPress? Leave a comment!