What Are WordPress Redirects And When You Should Use Them?

What Are WordPress Redirects And When You Should Use Them?
  • 8 min read

“Abracadabra! Your website has moved from here to there!”

No worries if that didn’t work. Redirection isn’t a magic trick. A redirect is a process in which a web page or URL is automatically directed to another web page or URL. It’s easy to do though!

WordPress redirects can be implemented using various methods, such as 301 redirects (permanent redirects that aren’t coming back) or 302/307 redirects (temporary redirects for use if you want to send people to a new site or page for a short period of time, such as when you’re redesigning or updating your website. Don’t forget to bring the old page back!)

Websites change. They are restructured and relaunched. Pages come and go. To avoid your visitors landing on a 404 (page not found) you can redirect old pages to new ones.

For instance, your old website had a blog packed full of great ideas. Links to these posts are scattered over social media, email newsletters, and bookmarks. Now you relaunch and your “blog” is now “news.” Once changed, none of those old links will work. 404 meltdown big time!

No worries. With a redirect, you can redirect those /blog pages to your /news folder.

“A 401 is often a temporary problem, unlike an HTTP 403 error in which you’re expressly forbidden to access the page you’re hoping to reach.”


What is a WordPress Redirect?

In WordPress, a redirect is a way to send visitors and search engines to a URL different from the one called up in the browser. There are URLs to twenty-year-old web pages still out there and not all of them are going to be active. A way to find the latest version of a URL is an important feature.

Redirects are often used to handle broken links, out-of-date links, to send visitors to the correct version of a URL (for example non-www to www), or to consolidate multiple URLs for the same content (canonicals).

WordPress Redirects with a Plugin

There are a few ways to create redirects in WordPress. Most of us probably create redirects in WordPress with a third-party plugin. All the SEO plugins offer access to the htaccess file and robots.txt. That way you can manage redirects from within the WordPress admin dashboard.

Using a stand-alone redirection plugin just bulks up your website with yet another plugin, stay tuned for an upcoming product announcement where you can manage your redirects directly from the Rocket.net Control Panel without the use of an additional plugin!

Old School WordPress Redirects
You can also create old school redirects — or as we like to say “be redirect agnostic” –  without a plugin. You can directly modify your .htaccess file or redirect using PHP code in your theme’s functions.php file.

“Setting up server side redirects requires access to the server configuration files (for example, the .htaccess file on Apache) or setting the redirect headers with server side scripts (for example, PHP).“


When Should You Use Redirects?

There are several situations where you’ll want to use a redirect:

You change the URL of a page or post on your website, or you restructure your site.

For example, if you change the URL of your “Services” page from www.mywebsite.com/services to www.mywebsite.com/our-services, you can use a redirect to send people and search engines to the correct URL.

The same goes for website restructuring. Your old structure might have had shoes as a top-level folder because you didn’t sell anything else. Now you sell boots and shoes, so you need to redirect /shoes to /products/shoes.

You move your website to a new domain.

If you change the domain of your website, you can use redirects to send visitors and search engines to the new domain.

You delete a page or post from your website.

If you delete a page or post and it’s still being linked to from other websites, from within your own site, or very likely on a social media post, you can use a redirect to send people to a related page instead of showing a 404 Page Not Found error. Don’t send them to your homepage.

The practice of sending people to your homepage is not user-friendly because people don’t know you’ve done it. They think there’s been some error and try to find the page they were trying to reach. Don’t do it.

You want to consolidate multiple URLs for the same content.

For example, if you have the same content accessible at www.example.com/page-red and example.com/page-ruby, you can use a redirect to send visitors and search engines to one URL to avoid duplicate content issues.

If you 301 redirect Page A–>Page B, then human visitors will be taken to Page B automatically and never see Page A. If you rel-canonical Page A–>Page B, then search engines will know that Page B is canonical, but people will be able to visit both URLs. Make sure your solution matches the desired outcome.


What are the Different Types of Redirects?

There are two main types of redirects: server-side redirects and client-side redirects. Both can be implemented in various ways.

Server-side redirects

A server-side redirect uses a 3xx HTTP status code when a URL is requested to forward the request to another URL. The server determines what URL visitors and search engines should be sent to based on the 301, 302, or 307 redirect used. 

Setting redirects in the .htaccess file is a server-side redirect. It’s normally the fastest and best way to redirect any old URLs to new ones.

“If server side redirects aren’t possible to implement on your platform, meta refresh redirects may be a viable alternative.”


Client-side redirects

A client-side redirect is handled by the visitor’s browser. This type of redirection is much slower.

Meta refresh redirect

Remember these? The meta refresh redirect, located in the <head>-section instructs the browser to load another URL after a certain number of seconds. The refresh sends the visitor to the new page once the old one has been called up, but the old page needs to exist, even if it’s empty.

<meta http-equiv=”refresh” content=”0; url=https://www.mywebsite.com/newpage”>

JavaScript redirect

You can redirect in the same way using JavaScript, too. Here is an example:


When Should I Use a Permanent (301) Redirect?

If you want to permanently redirect one URL to another, you should use a 301 redirect. This happens when you’re changing the structure of your website or moving a page to a new location. It happens more often than you think.

The 301 redirect tells search engines that the original page has been permanently moved to the new location. For SEO purposes, a 301 redirect passes on most of the original page’s ranking power to the new page. This helps ensure that you don’t lose any search engine traffic or rankings when you make changes to your website.

When Should I Use a Temporary (302 or 307) Redirect?

Type 302 redirects were often used for temporary redirects. However, with the advent of HTTP 1.1, 307 has mostly replaced it as a valid temporary redirect. 

302 and 307 redirects should be used when you want to temporarily redirect a page to a different URL. This type of redirect indicates to search engines that the redirect is only temporary and the original page should still be indexed. 

This is useful when pages are undergoing maintenance or updates (longer than a few hours). You can redirect visitors to another page while work is being done. 

It’s important to note that, unlike a 301 redirect, a 302 redirect does not pass on link equity (cringingly known as “link juice”) from the original page to the new page.

It’s also worth noting that if you set your temporary redirects and forget about them, Google will start treating them as a 301 and pass along any SEO value that link had. So “temporary” as in “not forever.”

How Do I Make Redirects in WordPress?

You have a few options when creating redirects in WordPress. 

  • You can use a plugin to change the .htaccess file, or you can do that manually;
  • you can use WordPress’s built-in wp_redirect function;
  • or, you can create a function in PHP in the functions.php of your child theme.

Let’s take a look at each of these:

Create a redirect in your WordPress .htaccess file

First, it’s important to know where to place your redirects in the WordPress .htaccess file. 

This is what the WordPress .htaccess file looks like out of the box:

# BEGIN WordPress

RewriteEngine On

RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteBase /

RewriteRule ^index\.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

# END WordPress


Redirect 301 /old-page/ /new-page/

  1. If you are accessing your .htaccess file directly in your FTP client, then open it in a text editor.

If you are accessing it via your SEO plugin, open the SEO plugin Tools, then open the .htaccess file. 

  1. Add the following code at the top of the file:

Redirect 301 /old-page/ https://www.anotherwebsite.com/new-page/

Replace /old-page/ with the URL of your page you are redirecting from and https://www.anotherwebsite.com/new-page/ with the URL your page you are redirecting to.

Note: If the redirect is to an internal page, the code would not include the path prefix. It would look like this:

Redirect 301 /old-page/ /new-page/

Don’t forget that space between the old and new page.

  1. Save the .htaccess file.
  2. Test the redirect you created by entering the old page URL in your browser. You should be redirected to the new page URL.

Create a redirect with the wp_redirect function:

You can use WordPress’s built-in wp_redirect() function to 301 a specific page

<?php if (is_page(‘oldpageURL’) ) 

wp_redirect( ‘https://www.mywebsite.com/newpageURL’, 301 );




Create a redirect in WordPress in the functions.php:

Note: You should only change the functions.php file of your child theme.

Add this to your functions.php file changing the new and old pages to your own:

add_action( ‘template_redirect’, ‘my_redirect_rule’ );

function my_redirect_rule() {

    if ( is_page( ‘oldpageURL’ ) ) {

      wp_redirect( ‘https://www.mywebsite.com/newpageURL’, 301 ); 




The Importance of 1-to-1 Redirects

When implementing redirects it’s essential to send the URL to another URL that most closely matches the original page. This is the best way to preserve the page rank and the keyword association of the original page. In addition, it’s the best way to not lose the visitor. If someone is looking for cookies, don’t redirect them to cakes.

Let’s say your website has a page about “How to build a mobile website” that you’re no longer using, but you don’t want to delete it.

Instead of redirecting that page to the home page, (don’t), you should 301 it to a page that’s most similar in the subject matter. For example your “Responsive WordPress themes” page.

Redirecting in this way will have a positive SEO effect and can maybe even reduce bounce rates and drop-offs.

How Does a 301 Redirect Help My SEO? 

Now the technical work has been done, we can sit down over our coffee and think bigger thoughts. Like, is there a relationship between 301 redirects and our website’s Google rankings? 

Well, because a 301 redirect is a permanent one, search engines understand that the old URL will no longer need to be indexed. Over time, the trust of the old page should be passed on to the new one.

Compared with temporary redirects, a 301 redirect is the best way to transfer page authority of an existing page to a new one. Why? Most likely it’s because of the internal links found on the old page. The main SEO benefit of doing redirects is the transfer of links, since it helps in transfering the previous rankings of the redirected page. 

Back in 2012, Matt Cutts said that Google had no limits in place for how many redirects it followed. But in 2020, John Mueller did talk about the implications of too many 301s strung together, suggesting that redirects can negatively impact speed.

Long story short: anything we do with our websites to help search engines and our visitors is going to be beneficial. Anything we do to try and trick search engines or our visitors is likely to come back and bite us on the nose.

“Redirects are not bad for SEO, but — as with so many things — only if you put them in place correctly. A bad implementation might cause all kinds of trouble, from loss of PageRank to loss of traffic.”


Don’t Let Your Attention be Redirected. Let’s Show You What The Fastest WordPress Hosting Actually Means for Your Website and Your SEO

Are you excited? Ready to take your website in some new directions? And no extra plugins to weigh your site down! Let us show you how all your hard SEO work needn’t be lost to technical sleight of hand.

New call-to-action

Let’s talk about how we can migrate your portfolio of client sites to Rocket.net, the fastest WordPress hosting in the world.