How to Redirect a Page in WordPress – In this article, I will explain how to implement redirect and redirect in WordPress. You’ll learn how to set up automatic, manual, and wildcard redirects.
Table of Contents
Why do you need a redirect?
Redirecting posts, pages, and links in WordPress can be required for a variety of reasons. You may have changed the slug (label, part of the permanent address) of an individual post or page, or made changes to the settings of permanent addresses in general. Or perhaps you’ve published a new article and want to redirect an old post to it.
In all these cases, you need to do a redirect (redirect): so the browser will go to a new link instead of the old one. To enable redirection, you need a special plugin. In this article, I’ll show you how to work with the Redirection plugin .
Cons of Redirect
Using a redirect is not the ideal solution. A redirect slows down the opening of the landing page for the user, because the browser first follows the old link, is instructed to redirect, and only then opens the desired publication.
In addition, there is a chance that you will set up the redirect incorrectly, or even forget to redirect after changing the link. Another disadvantage concerns search engine optimization and ranking – from the point of view of Google, links that use redirects do not have much value.
So it’s best to avoid redirects altogether. To avoid having to change links in the future, you should think about optimizing them from the very beginning:
- Set up permanent, human-readable addresses before you start publishing posts and pages.
- Check the slugs ( labels ) of all posts and pages before publishing: make sure they are equally optimized for both people and search robots.
If you have not done any of the above and now you need to make corrections, then I will tell you what needs to be done.
How to Redirect a Page in WordPress
The setting is redirected to WordPress
There are several types of redirects that you may need when using WordPress. Most likely you will need to configure:
- automatic redirect;
- manual redirection;
- redirect with substitution.
Let’s consider all these types of redirection in more detail.
Setting up an automatic redirect
Install the Redirection plugin for WordPress if you don’t already have it. During installation, the plugin allows you to enable the option to automatically track changes in addresses and activate redirects. The extension can also check for updates to existing posts and pages and enable redirects from old slugs to new ones.
In the screenshot below, you can see that the plugin tracked the change in the existing post and added a redirect from the old address to the new one.
What happens if changes to publication addresses are made after activation? The plugin will track these changes and automatically set up a redirect. The screenshot below shows how the plugin reacted to the change in post addresses.
Setting up a manual redirect
In some cases, the plugin will not be able to redirect automatically – for example, if you need to redirect one post to another or redirect a publication on the site to a resource located on a different domain.
In these cases, redirection is done manually, without using a plugin. To do this, open the Tools section in the console, go to Redirections and find the Add a new redirect section .
In the Source URL field , enter the address from which you want to redirect. In the Destination URL field , enter the new address you want to go to. In the Group field , either leave the default value ( Redirects ) or select Changed Posts if you want to redirect from the old post to the new one. This way the browser will be informed which type of redirect a particular redirect belongs to.
After that click on the Add redirect button and the redirect will be added to the list of redirects.
Setting up a wildcard redirect
Wildcard redirects are used when you want to redirect a group of links that include certain common elements. For example, if you change the permalink structure, such a redirect will redirect any link in the old structure to a similar link in the new structure.
Let’s say you’ve changed the permalink structure for posts from the old /blog/post-title to the new /category/post-title . What you need is a wildcard redirect to redirect users to new post addresses.
Element substitution redirect uses an advanced technique called Regex (regular expressions). With it, you can set templates for redirecting specific groups of links.
To set up a wildcard redirect, you first need to create a Regex function. Go to Tools , then to Redirects and to the Add a new redirect section .
In the Source URL field, enter the old category path and the desired regular expression, in this case
/oldslug/(.*)$. In the Destination URL field , enter the group redirect to
/newslug/$1. After that, save the redirect by clicking on the Add redirect button .
If you need to change the permalinks of posts on your WordPress site, or redirect visitors from old posts to new ones, use a redirect. Depending on the changes made, redirection can be automatic, manual, or wildcard. In this article, we have covered all types of redirects.
Please leave your feedback on the current topic of the material. For comments, responses, likes, dislikes, and subscriptions, bow to you!