If you’re planning to migrate or update your site, you may need to change some of its URLs. However, this means that users who visit the old links will likely encounter a 404 error, telling them that the page can’t be found. Therefore, you might be wondering how to set up WordPress redirections on your website.
Fortunately, it’s easier than you might think. Once you have a good understanding of the different types of redirects, you can use a plugin to implement them. This way, users who land on the old URLs will be automatically redirected to the new ones. ⚙️
What are WordPress redirections?
When a user clicks on a link to a page that no longer exists, they’ll probably get a 404 error. This typically means that the page has been taken offline, or that its URL has changed:
As a website owner, you might find yourself switching to a new content management system (for instance, from Wix to WordPress). Alternatively, you might decide to migrate to a new host. Either way, the procedure is usually quite straightforward, although some of your pages or links might break in the process.
Even if you’re not planning to migrate your site, you might still need to change your URLs. For example, while optimizing your old posts, you’ll likely have to add new keywords to the links. You might even decide to change the name of your site but keep the same slugs for your pages and posts.
In any of these scenarios, you’ll need to set up WordPress redirections. This way, anyone who comes across your old links will be redirected to the new pages. This includes search engine bots.
Without redirects, your old URLs will be flagged as broken links, which can harm your rankings in search engines. Additionally, users who land on your broken pages will probably be disappointed and exit the site.
Redirects can therefore help you preserve both your rankings and User Experience (UX). However, you should make sure that you set up the right redirections.
Types of redirects
Before we show you how to set up WordPress redirections, let’s briefly go over the different types of redirects. Typically, these include:
There are also HTTP to HTTPS redirects. If you’ve recently implemented a Secure Sockets Layer (SSL) certificate on your website, you’ll likely need to redirect the HTTP version of your site to the HTTPS one.
Otherwise, Google could treat them as two separate sites, which could be harmful to your rankings. Plus, you’ll want to make sure that users are directed to the safe version of your site.
How to set up WordPress redirections
Now, let’s look at three different ways to set up WordPress redirections. We’ll start with the easiest methods, which involve using a redirect plugin or SEO tool. Then, we’ll move on to a more difficult way and show you how to create redirections by editing your site’s files.
1. Install the Redirection plugin 🖱️🔌
Redirection is an easy-to-use plugin that enables you to set up 301 redirects on your site. To install it, navigate to Plugins → Add New in your dashboard, and type in “redirection” in the search bar:
Then, hit Install Now, followed by Activate:
Now, go to Tools → Redirection and click on Start Setup. The plugin will then ask you to select a few settings. For example, you can enable Redirection to monitor URL changes and automatically set up redirects:
Once you’ve completed the setup, you can create your first redirect:
In the Source URL field, you’ll need to enter the slug of the old URL. For example, if the link is ourwebsite.com/who-we-are, the slug would be /who-we-are:
In the Target URL field, enter the slug of the new URL. Finally, click on Add Redirect:
This will be added to your list of redirections:
That’s it – users will now be directed to the new URL!
2. Use an SEO plugin like Yoast SEO 👨💻🔌
Many SEO plugins enable you to set up WordPress redirections. If you’re using Yoast SEO, this feature is available with the premium version.
To set up redirections in Yoast, navigate to Yoast SEO → Redirects. Then, choose a redirection type.
Yoast gives you the following options:
- 301 Moved Permanently
- 302 Found
- 307 Temporary Redirect
- 410 Content Deleted
- 451 Unavailable for Legal Reasons
In the Old URL field, simply enter the slug of the link you want to redirect. Then, enter the new slug in the URL field and hit Add Redirect.
3. Edit the .htaccess File 📝💻️
This method should only be attempted if you’re familiar with your site’s root directory, or you’re comfortable editing WordPress files. Also, you’ll want to make a backup of your site before you proceed, just in case you accidentally delete a file.
To edit your .htaccess file, you’ll need to access your site’s root directory through a File Transfer Protocol (FTP) client, like FileZilla. Alternatively, you can use the File Manager in your hosting account (which is probably easier).
Your site’s root directory will likely be labeled public_html. Inside this folder, you’ll find the .htaccess file:
Right-click on it and select Edit. This will open the file in a text editor. Here, you’ll need to paste in the following code:
Redirect 301 /old-page.html http://www.mysite.com/new-page.html
Of course, you’ll want to replace those URLs with your own. When you’re ready, save your changes and close the file.
When you move a page to a new URL, you’ll need to set up a 301 redirect (if it’s a permanent change) or a 302/307 redirect (if it’s temporary). This way, anyone who visits the old link will be directed to the new page, thus preventing 404 errors and keeping users engaged. Plus, WordPress redirections can help you preserve your rankings in search engine results.
👉 To recap, here are three ways to create WordPress redirections:
Do you have any questions about setting up WordPress redirections? Let us know in the comments section below!