How to Redirect a Page or URL in WordPress – [Full Guide]
Why Redirect Pages or URLs?
In WordPress, there are a variety of situations in which you may need to redirect a post, page, or URL address. Perhaps you’ve made a change to the slug for a particular post or page. It’s possible that you’ve changed your permalink settings. Alternatively, you may have written a new post and wish to redirect an older post to it. It is necessary to put up a redirect in each of these situations.
This instructs browsers to navigate to the new URL rather than the old one. You’ll need to install a plugin in order to set up redirects. It is my intention in this post to show you how to accomplish this using the Redirection WordPress plugin.
Why Not Use Redirects?
Setting up redirects isn’t the most convenient solution. It slows down the user’s experience because the browser will navigate to the first URL, receive the redirect message, and then navigate to the second URL. Furthermore, there is a possibility that you will set up the redirect incorrectly or that you will just forget to do so after updating a URL. Not only that, but links that come through a redirected page aren’t worth as much in terms of SEO because Google doesn’t place as much emphasis on them. As a result, it is recommended that you avoid changing your URLs entirely. Make sure that your URLs are optimised from the beginning in order to reduce the number of times they need to be changed:
- When you first set up your site and before you add any articles or pages, make sure your permalink settings are set to use attractive permalinks so that your site looks nice.
- Before you publish a post or page, you should configure the slug for that particular post or page. Make certain that it is appropriate for both search engine optimization (SEO) and user experience (UX) (UX).
- However, if you haven’t previously done so and you need to redirect your URLs, how do you go about doing so?
How to Set Up Page and URL Redirects in WordPress
When it comes to WordPress redirects, there are several distinct types that you may want to consider using. The types that you’ll most likely be employing are as follows:
- automated redirects
- manual redirects
- wildcard redirects
Let’s take a look at each of these WordPress redirects.
Setting Up Automated Redirects
Install the Redirection plugin for WordPress immediately if you haven’t already. When you first install the WordPress redirect plugin, you have the option of automatically tracking URL changes and setting up redirects. The link redirect builder plugin will also scan your existing articles and pages for revisions and set up redirects from any old slugs you may have used for them. In the example below, it detected a change in the slug of an existing post and added a redirect from the old slug to the new one.
What if I alter my slugs or URLs once I activate them? The link redirect builder plugin will detect them and put up the redirect automatically. The WordPress redirect plugin interface after more slug modifications is shown below.
Setting Up Manual Redirects
Sometimes the WordPress redirect plugin will miss the page redirect you require. Perhaps you want to redirect one article on your WordPress site to another, or you want to redirect a URL on your domain to a different website. In this scenario, you’ll need to set up a manual redirect in WordPress without the use of a plugin. Scroll down to the Add new redirection area under Tools > Redirection.
Type or paste the URL you want to redirect from into the Source URL section. Enter or paste the URL you want to redirect to in the Target URL area. If you’re redirecting from an older post to a newer one, leave the Group option as Redirections (the default) or select Modified posts. This will provide browsers with information about the type of rerouting. Finally, press the Add Redirect button to add your manual redirect to the list of redirects.
Setting Up Wildcard Redirects
When you wish to redirect a group of URLs that share particular elements, use a wildcard redirect. For example, if you alter your permalink structure, a wildcard redirect will redirect anyone who uses a link from your old structure to the identical link in your new structure. If you change your post permalink structure from /blog/post-name to /category/post-name, for example, you’ll need to employ a wildcard redirect to ensure that everyone using the old links is diverted to the new URL. Wildcard redirects make advantage of a feature known as Regex, which allows you to design complex redirects. To set up a wildcard WordPress redirect, you must first activate Regex functionalities. Scroll to the Add new redirection portion of the screen by going to Tools > Redirection.
Enter the old path to categories as a wildcard in the Source URL column. It must be in the format /oldslug/(.*)$. The Target URL entry must include the source /newslug/$1. Then, on the Add Redirect button, confirm your selection.
You’ll need to set up a redirect if you alter the URLs on your WordPress site or publish a new post to replace an old one. You might use an automatic redirect, a manual redirect, or a wildcard redirect depending on the changes you’ve made. You learnt how to generate redirects for various situations in this tutorial.