A redirect is one link that leads you to another link. Easy to say and, yes, easy to create them!
Redirects have lots of applications, including making shorter links for a page or website, sending your visitors to updated URLs, moving your site to a different domain, and reorganizing URL structure to name a few.
As we all know SEO is essential for any website and to have a healthy and organized SEO URLs structure you need to use redirects from time to time. All types of redirects have specific goals and it is important to use the right one to provide the proper information to search engines and maintain good rankings.
In this article, we’ll explain the most-used redirects types (301, 302 and 307), and two easy methods to create them.
Redirects for Beginner’s
We will give some general explanation about the types of redirects, and their basic functionality:
301 redirects are the ones you use when you want search engines to replace the results of an old URL with a new one. Search engines will stop indexing the last page and pass the rankings to the new page.
Old URL > New Permanent URL
The new URL should be permanent, in case you want to redirect in a non-permanent way, check some of the redirect options below.
As an example, you can use a 301 to redirect your old domain to your new domain in case you did a rebrand of your website, so this way the search engines will pass all of the search results to the new URL.
302 redirects are used to redirect your users to an alternative website or page of the one they requested. Search engines will understand that the previous page is probably going to be used again, as the 302 redirect is used for temporal URL changes.
Requested Page > Found/Temporal Page
We recommend you to use it to redirect the users to a similar page, to replace the result they were looking for.
For example, let’s say you are making some changes to your online shop and it’s temporarily unavailable, you can use 302 to redirect your visitors from the Shop URL, to a temporal Shop page. After the normal Shop is back online, you can reuse the origin URL again.
307 redirects are used to send your users to a temporary page, but this temporary page doesn’t need to be an alternative page, as in 302 redirections. The search engines will understand that this a temporary URL and they will not index the new direction.
Requested Page > Temporal Page
As you may see, 302 and 307 are very very similar, and as a rule of thumb, we recommend you to use 307 redirects in case you don’t know what to use.
For example, if you are making big changes on your website and you don’t want to lose your traffic while doing this, you can use a 307 redirect to send your visitors to your Facebook page. Some days later, you just remove the redirect and your visitors will enter your brand new website. In this way, your visitors will have no inconvenience.
Also, as an extra tip before going to the next section, beware of making chained redirects (more than 5 redirects at a time), since that could create an error and the browsers won’t show the page to the user, which is something you don’t want to happen.
Create Redirects in WordPress with Redirection (Plugin)
There are some plugins available out there to easily create redirects. In this case, for basic needs, we recommend you to use Redirection plugin for multiple reasons:
To install it, you just need to go to the plugin page, download it and install it, or, directly install it on your WordPress Dashboard from Plugins > Add New.
Once installed, you will see that the Redirection tab will be added on your Tools in the WordPress Dashboard and if you click on there it’ll give you a brief introduction.
You will see the introduction screen where it will briefly mention the functionality of it, and how it works. Once you are ready you can click on the Start Setup button, and continue to the following.
Basic Setup: We recommend you to set it up as shown in the screenshot below.
Each checkbox here means the following:
- Monitor permalink changes in WordPress posts and pages: The first box will allow Redirection to create permanent redirects (301) automatically for URL changes. By activating this feature, Redirection will create new redirects if you change any permalinks of your posts and pages so you don’t have to do it manually, and this way your URLs will be healthy and updated.
- Keep a log of all redirects and 404 errors: The second box will allow the plugin to record logs of 404 errors from the users, so you will know if users are being driven to a 404 error page for any reason, and be able to fix that. It is important to notice that this will generate more data on the database and can increase its size.
We don’t recommend you to store IP information, because for legal reasons you have to give a declaration of the data you are storing and it is likely that you will not use this information anyway.
REST API: Lastly, the plugin will inform you if the REST API system is activated. This is used to connect the plugin to third party applications, but this is quite technical and most of the times you won’t use it, so you don’t have to worry about it. In case you are quite technical and would like to use the API for any reason, you can check the API documentation.
Now you’re ready to create redirects!
Let’s cover the different functions offered by the plugin starting with Redirects, the most important one and the heart of the plugin, as it allows you to create the redirects with the next section:
In the redirects section, you can create and manage your actual redirects. To create one, you will see the Add new redirection section, and you will need to fill the following fields:
Source URL is the URL that is going to redirect the users to the new page/link. You can also click on the right dropdown to personalize it with Regex, or other options if needed. For example, with Regex redirects you can set patterns of redirects, that means that you can use more than one Source URL to a Target URL.
Target URL is the URL of the page that your users will be redirected to.
This option allows you to ignore or match all the URL parameters. Everything after a ‘?’ in an URL is a parameter and they have different functions. So for example, if you usually add URL parameters for Google Analytics, this setting will ignore, or match these parameters. Keeping this in mind, we recommend you to Ignore all parameters unless you have a specific reason to use another option.
If you want more extended options, click on the engine icon as shown in the next screenshots. However, for basic needs, the already filled fields are more than enough, so you can click the Add Redirect button and you are ready to go.
Advanced Redirect Options
This option lets you choose a setting to only redirect in case the match is met. For example, if your business has an app, you can set-up a Match option to redirect your users to Google Play or App Store when the user agent of Android or iOS is meet. This is just an example, but thanks to the different Match options, you can get creative and do many things.
With this option, you can choose to add the redirect to a group. You can select a group to easily keep track of your redirects, in case you like to edit them in the future. For example, if you have 100 redirects for product links, you can add them to a “Products” group, so in case you want to edit them in the future, you can find them right away. These options come in handy when you have tons of redirects.
And that’s all! Once you finish filling these, your redirects settings are ready, and you just need to click Add Redirect.
Finally, on this same Redirects tab, you can also do Bulk Actions like Deleting, Enabling, Disabling, and others directly from the top of the table.
Now let’s explore the other tabs too.
This tab allows you to organize all your redirects into categories, see them and search them. This will help you to manage tons of redirects smoothly.
This tab allows you to see the redirects that have been done organized by Date, URL, Referrer/User Agent, and IP.
This tab allows you to see all the 404 not found errors that have been registered by Date, URL, Referrer/User Agent, and IP.
This can help you to identify if your visitors are typing, entering or simply going to URLs that will lead them to 404 errors. Knowing this will help you to change your URLs and redirects to avoid these errors.
Naturally, the fewer errors you have, the better for your user experience, SEO and rankings.
Import and Export WordPress Redirects
This tab allows you to import and export lists of redirects. In this way, you can easily bulk upload many redirects to your WordPress site. However, it’s important to know how to upload the redirects list to avoid errors.
The screenshot below is an example of how a CSV file of redirects looks, and once with that, by importing it you will be able to add tons of redirects fast and effortlessly.
And that’s it! These are the main features of the plugin we recommend you. As you can see, you don’t need to know a lot to create and manage the redirects for your site. We hope this plugin is as valuable for you as it is for us.
And finally, we will cover how to create WordPress redirects without using any plugins. If you are interested on that, keep reading.
Create Redirects on WordPress with .htaccess
If you are a WordPress user with a DIY mindset, and you want to keep your site free of lots of unnecessary plugins, this method for creating redirects is perfect for you.
.htaccess is basically a configuration file that manages redirects, cache and other settings of the Apache webserver configuration on your WordPress. You can learn more about it here.
So, with .htaccess you can easily create and manage redirects without installing any extra plugin. To edit this file you can do it directly from your hosting control panel or with one of the three following options:
- Cyberduck: Cyberduck is a free FTP/sFTP client and cloud storage browser for Mac and Windows that you can download here
- FileZilla: FileZilla is an open-source FTP/sFTP client for Mac and Windows that you can download here
- Yoast SEO: As another extra tip, you can also use the Yoast SEO plugin to also modify the .htaccess file in case you don’t want to download any extra software to your computer. You just need to install Yoast SEO, and you will find this editor on Yoast SEO > Tools > File Editor
Now we’ll show you some code that will help you to create redirects with .htaccess:
Create 301, 302 and 307 redirects with .htaccess
To create 301, 302 or 307 redirects you just have to add the following code to the .htaccess file:
RewriteEngine On Redirect 301 /source/ https://target.com/target
The first part /source/ is the source parameter, where you need to write the page you would like to start the redirect. The second part https://target.com/target is the target parameter.
For example, if you want to redirect from webflin.com/gallery to webflin.com/new-gallery, you just have to write it like this:
RewriteEngine On Redirect 301 /gallery/ https://webflin.com/new-gallery
Then, if you would like to change the redirects type from 301 to 302 or 307, just change the 301 number to 302/307. And just like the last example, replace the information and that’s it.
RewriteEngine On Redirect 302 /gallery/ https://webflin.com/new-gallery Redirect 307 /gallery/ https://webflin.com/new-gallery
As a note, you only need to add RewriteEngine On one time, so, after it you can add as many redirects as you would like to.
As you can see, adding manual redirects can be a little more tricky and boring. So, unless you have a very specific reason why you would like to do so, we highly recommend you to use Redirect plugin instead.
And that’s all for now, as you could see, creating redirects is as easy as installing a plugin and adding the links. From now on, you can always have the right redirects on your site. If you would like to see some more advanced articles about redirects or any other topic in the blog, feel free to let us know in the comments.