Redirects pages in WordPress

Page redirects in WordPress is far from the easiest topic to discuss, especially if this is your first time encountering it. Many people are aware of the existence of redirects (redirects) of pages in WordPress, but they are far from always sure about when to use them and how to do it correctly.
In this post, you”ll learn everything you need to know about page redirects in WordPress.

Why might you need redirects?

Page redirects may be required for several reasons:
There is an error in the URL and title that you want to fix.
Binding other keywords to your page.
Changing the structure of permalinks.
The external link was pointing to the wrong address, and you want visitors to navigate to the correct page.
You want to change part of your URL, for example remove www and / or switch to HTTPS.
You”ve switched to a different domain and want your previous site”s traffic and SEO metrics to flow to your new site.

Why are redirects important?

From the list above, it is probably already becoming clear why page redirects are a good idea. If your site moves, you hardly want to start from scratch, losing all your traffic and links.
Even if one page is lost, it will lead to a 404 error. The experience is not the most pleasant one, as you can imagine. All this greatly annoys visitors.
Search engines do not like these mistakes, and therefore they can punish you for it. It should be important for you that they correctly recognize the structure of your site and index it correctly. If necessary, you can leave the following text on such pages: ‚ÄúThis page no longer exists. To access it, follow the link below. “

Different redirect codes and what they mean

Redirects are divided into several types. They are classified by HTTP codes, just like the above 404 error code for a non-existent page. However, redirects are categorized as 300:
  • 301 is the most common type of redirect. He says that the page has been moved permanently, and now its new version can be found elsewhere. Such page redirects transfer approximately 90-99% of SEO power (from old page to new).
  • 302 – The page has been temporarily moved. The original URL is currently unavailable, but it will return back, for now you can use the page with the new link. The link power is not transferred.
  • 303 – Used only for form submissions to prevent users from re-submitting data when using the browser back button. You probably won”t need this unless you are a developer.
  • 307 is the same as 302, but only for HTML1. Indicates that the content has been temporarily moved to a new address.
  • 308 is a permanent version of a 307 redirect.

Redirects and page speed

Page redirects are a great tool for webmasters and marketers, however their disadvantage is that they can have a huge impact on page speed.
Redirects are an extra step in page loading. Even though they add minor milliseconds, this is all very important, because visitors want the page to load as quickly as possible.
Also, redirects of pages in large numbers can prevent search robots from indexing your site. Therefore, here are some important rules for their correct use:
Avoid chains of redirects. Redirects from http to https and www to non-www URLs can create a chain of redirects. There is no need to arrange ping pong. All redirects must go directly to the same domain (https://domain.ru).
Don”t redirect links that you have control over. Better to manually change them, don”t be lazy. This includes, for example, links in the menu.
Try to correct external links. If the link is incoming, you can try to contact the site owner and ask him to fix the link on his side.
Page redirects should be kept to a minimum. To find multiple redirects, you can use the Redirect Mapper tool.

How to find pages to redirect and prepare correct URLs

How do I find pages to redirect after moving a site? You can start with Google Search Console. The Coverage section records all 404 errors and scan errors.
Please note that not all 404 errors are displayed by Search Console. For tracking non-existent pages, it is best to use a crawler like Screaming Frog. Also some plugins below will help you.

Now you can prepare redirects:

Enter the correct URLs. Be sure to stick to one format. Always redirect to the same version of the site, i.e. to the preferred domain (www / no-www, http / https, etc.).
Set the slug instead of the URL – this means setting / your-page-slug instead of http://yoursite.com/your-page-slug. In this case, your redirect will be resistant to any changes in the main domain (moving to https, etc.).
Redirect to relevant pages. It is advisable to find a page with a similar topic. It is not recommended to simply redirect to the main page.

How to correctly redirect WordPress

There are several ways to implement a redirect in WordPress. You can do this via a plugin or manually via .htaccess. Both methods have their pros and cons:
Plugins are an easy-to-use approach, but potentially slower as many plugins rely on wp_redirect, which can lead to performance issues.
.htaccess is a more advanced approach. For example, you can include directives for gzip compression in .htaccess. Using .htaccess is faster because redirects are configured at the server level. However, any mistake can cause your site to stop working.
Let”s take a closer look at each of these methods.

Using plugins.

There are many different plugins that allow you to set up redirects in WordPress.
Redirection is one of the most popular WordPress directory solutions. It can be used to set redirects via htaccess, Nginx and WP core.
Simple 301 Redirects is an easy to use plugin with several options.
Safe Redirect Manager – using this plugin you can set the code that will be used for redirects. For added security, the plugin restricts redirects to whitelisted hosts only.
Easy Redirect Manager – suitable for 301 and 302 redirects. The plugin has many different options.
All plugins work in much the same way. They offer an interface where you can enter the source URL and the final URL (after the redirect).
Some plugins also have additional functionality. For example, the Redirection plugin allows you to track visitors to non-existent pages.
Using .htaccess
.htaccess is usually located on your server with your WordPress site. You can access it via FTP.
By default, the file is hidden, so you may have to enable the option to show hidden files in the FTP client of your choice.
Save a copy of the old .htaccess file just in case.
A simple redirect from one page of your site to another would look like this:
01 <IfModule mod_rewrite.c>
02 RewriteEngine On
03 Redirect 301 /old-blog-url/ /new-blog-url/
04
05 </IfModule>
If the IfModule mod_rewrite.c block with the closing IfModule already exists, then you need the following code:
01 Redirect 301 /old-blog-url/ /new-blog-url/
Just add it before the closing IfModule. You can also use wildcards in redirects. For example, the code below is used to redirect all visitors to the non-www version of the site.
01 RewriteCond %{HTTP_HOST} ^www.mydomain.com$
02 RewriteRule (.*) http://mydomain.com/$1 [R=301,L]

To create directives for redirects, you can use the following useful tool.

When you’re done, just save the file. Be sure to test everything thoroughly!

Note that there are other, less common ways to implement redirects. However, the ones described in the article are recommended.

Leave a Reply

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