Are you facing problems with redirections in WordPress? Don’t you know how to create redirections in WordPress blog? Don’t worry, you are at right place.
In this post, we will cover in details about redirections and how to create redirections in WordPress.
What are Redirections in WordPress
Before starting to know how to place redirections, we need to know about redirections.
Redirections in WordPress simply mean redirecting visitors or crawlers to a different post or page. They are used to redirect a post or page to another location, inside or outside your website.
Redirections are very useful in dealing with error pages, especially with error 404 (not found) pages.
There are 4 types of redirections in WordPress that we can use
Which Redirection should you use?
You should choose your redirection type according to your need. Here I am going to explain types of redirections so you can choose which one is for you.
301 redirects are the most used redirection type in WordPress.
301 Redirects: (Mostly used)
It is a permanent redirect. If you don’t need a post or page anymore, you can place a 301 redirect.
This redirection tells crawlers that URL is moved permanently. The search engine will replace the post on which you have place 301 redirects, with the post it is redirecting to.
- This is mostly used in cases when you want to change the slug of a post, page or category.
- If you are going to change permalink structure of your posts then you should place 301 redirects to avoid 404 errors.
- If you are deleting a page, post or any content.
302 redirects: Temporary redirect, mostly used for temporary redirecting. Placing 302 redirect tells crawlers that the page is temporarily redirected.
307 Redirects: Temporary redirects, same as 302. Used to create a redirection for short period of time.
308 Redirects: Same as 301 redirects used for permanent redirection.
Most of the time you will need 301 redirects in WordPress for permanent redirection. The default redirection type in WordPress is 301 redirects.
How to Create Redirections in WordPress
I am going to discuss two ways to create redirects in WordPress blog. One is by using plugins and another by editing .htaccess file.
If you are a newbie or you want to redirect many links then I will recommend you to use the plugin.
Create Redirection In WordPress using Redirection Plugin
This is the simplest way to create redirects in WordPress. Install the Redirection plugin and activate it.
- Navigate to Tools > Redirections.
- In Source URL enter the post or page name which is to be redirected.
- In destination URL enter the post or page to which it is redirected.
- Click on Add Redirect button to save it.
Check If your redirection is working properly because if you have done something wrong then it will throw error 404 page.
Note that if you are using a cache plugin then clear the cache to see the changes.
Create Redirection in WordPress by editing .htaccess file
This is an alternative way to add redirections, recommended only for advanced users.
If you edited the .htaccess file in the wrong manner then your site will be inaccessible.
You can locate your .htaccess file by FTP or Cpanel file manager. The file is present in the root directory of WordPress installation.
Edit .htaccess file using notepad or Cpanel editor and add following lines at the end of the file :
redirect 301 /old-post/ http://domain.com/new-post/
Don’t forget to replace placeholders with your post slug and the domain name of the target website.
I will recommend you to refresh your site immediately after editing .htaccess file. If anything thing went wrong then revert back the changes and save .htaccess file.
At last, I only want to say that redirections in WordPress are very useful if you use them correctly. They may also ruin your site if you did anything wrong.
Be careful while editing the .htaccess file because it can make your whole site unavailable for users. I will recommend you to install a plugin for redirection purpose.
If you have any problem related to redirections in WordPress, let us know by comments.