How to do 301 Redirects in WordPress and htaccess and rank better

Do you know that even a single 404 URL pointing to your site creates negative SEO impact on your website? If you delete your old posts, you can preserve your existing SEO and that particular page value (or Page Authority) by 301 redirects methods. Whether you are a blogger or a webmaster, you must have the knowledge of 301 redirects because this basic knowledge will surely help you running your long term online business.

301 redirects in WordPress


What is redirection in WordPress?

Redirection is nothing but sending both users and search engines to different URL from the one they originally requested. It is not limited to WordPress, but can be done for any type of website.

And since we are talking here about 301 redirect, 301 is a HTTP status code which specifies the URL you want to visit has been “Moved Permanently“. 301 is considered the best redirection method which will restore your page value and up to 99% of link juice.


What happens if your website contains 404 links?

You should trace out any old post or pages you deleted and redirect that URL to new relevant page to retain user experience as well as your Page Authority. If not, than your website will tend to follow negative SEO.


Which method to follow for 301 redirects?
  1. If you are using WordPress, then you can directly install a plugin and perform redirection. But I would suggest not to use plugins as they make your website heavily loaded and increases the loading time of your website. If you still want to take help of plugin, then navigate to last subtopic below. Keep reading.
    Learn How to decrease your website loading time and rank better.
  2. You can write 301 redirects rules in htaccess file.


Before starting, have a look that why we only do 301 redirection techniques. The below info graphics will clear your whole doubt.

301 redirects in WordPress and htaccess infographics


301 redirects is required in 2 cases

  1. While you are deleting an old post
  2. While redirecting your old domain name to new domain name


1. How to perform 301 redirects when deleting any post (htaccess)

Let us consider the case when you delete an old post. After you delete an old post, if any user or search engine bot comes to your site by accessing the deleted URL, they will get 404 error page. This 404 error page affects very negatively in your user experience as well as your website SEO.

If you open Google Webmaster tools after deleting your post, you will find crawl errors for the page you removed is with 404 error response which needs to be fixed. The fixing includes either removing that URL from Google caches or redirecting this old URL to other URL on your website.

  • If you remove this URL only from Google cache (from Google URL removal tool), then Google bots will not consider this URL for indexing and you will loose link juice coming through that link, ultimately resulting in loss of Page values (Page Authority).
  • If this URL is placed anywhere on Internet then users can still come to your site and they will see 404 error page. This affects User Experience and will definitely increase your Bounce rate too.

Both of the above points doesn’t seems to look pretty fair. So what to do if you are deleting any old post?

Just redirect the old URL to any other relevant page to conserve your user experience. This will not affect anything and the link juice passing from old URL will automatically pass to new URL without any affecting your User experience as well as SEO.


2. How to perform 301 redirect when moving from old domain name to new domain name (htaccess)

If you want to redirect your old domain to new domain name without loosing your traffic and Authority then you will have to do permanent redirection by using HTTP 301 redirects strategy. As of now, most of us are using Apache server for hosting our application. So just copy paste the below code into your htaccess file which will be present in root folder of your cPanel account.

 NOTE:   If you don’t find htaccess file, then remember to turn on “Show hidden files“. If then also not found, then create one text file and rename it to “.htaccess” in your root folder and copy paste this code with modification stated below.

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
 RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
 RewriteRule (.*)$ $1 [R=301,L]


Of course, here you will have to replace the olddomain with your old website domain name and newdomain with your new website domain name. Please note that the above code will change the domain name only.

For example, you wanted to visit, ““. Now if you perform this redirect, the old URL will redirect to ““.

In short, the domain names will change but the pages URL’s will remain as it is. It is highly recommended not to change your existing page and post link structure when migrating from one domain to other. If you want to do so,  then you will have to add redirects rules for each page separately in htaccess file which will be time consuming and tedious.

If you just want to change the existing page URL to new changed URL then do like this

Redirect 301 "/old-page.html" "/new-page.html"

You can also redirect specific URL to other domain or sub-domain like

Redirect 301 "/old-page.html" ""


How to do 301 redirects in WordPress (using plugin)

To do 301 redirects using plugins, I would like to suggest Simple 301 Redirection plugin. Install and activate this plugin and navigate to Settings-> 301 Redirects from your WordPress dashboard and write the old and new URLs you want to redirect and click Save.

But this redirection can take some loading time because this rules reside inside your website settings but not on top of your website and can increase your website loading time. In that case, follow the above method of copy pasting the code from above subtopic in your htaccess file. In addition to this, I have also written post to increase your website speed.


Bonus Tip

If you want to move from http to https (Since Google gives more ranking boost to websites having HTTPS), then you need to redirect your old URL to new https URL. Remember that when you change from http to https, your website is considered as new website and you will have to submit separate sitemap of your https version website.

For example, my blog was once hosted on http. But when I changed to https, I did the 301 redirects for all my existing website instances to newly https verion. I added the below code as it is in htaccess file.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$ [L,R=301]
RewriteBase /

Here it means, that any request coming to will be redirected to https version of my blog.


Let’s share

Share this article if you find this helpful for your friends. This article is a must read and must bookmark article for all bloggers and webmasters who are dedicated to long term online business.

How to do 301 Redirects in WordPress and htaccess and rank better
Article Name
How to do 301 Redirects in WordPress and htaccess and rank better
301 redirects is the most suitable redirection method if you don't want to loose your website SEO. These plugins will help you to manage this redirection by one click. Another strong method to do redirection is by pasting this code in your htaccess file.
Publisher Name
Apoorv Sukumar
Publisher Logo
How to do 301 Redirects in WordPress and htaccess and rank better
4.5 (90%) 4 votes

Apoorv Sukumar

A blogger and a Software Developer, exploring trending technologies in market. A philomath, web explorer, who learns many things and want to deliver them to the world. Founder of

You may also like...

9 Responses

  1. realy is very important knowledge to know, it’s somthing extra , thank you for this nice information.

  2. This Very Nice and attractive Article…
    Thankyou For Sharing This Information…
    And also give to me important knowledge.

  3. I learned a lot from this blog. thanks for sharing.

  4. Dieter says:

    Well explained to understand all of it. I was only wondering how a 302 is actually created. Since on purpose, I am not aware that I can temporary move it. Who makes this error code? Usal it comes from the Web server back to the browser correct ?

  5. Andrea says:

    Thanks for sharing this post with us. It is so informative and helps bloggers that are starting out.

  6. Khan Bhai says:

    Thanks it is great article it is what that I need

  7. Shaun says:

    Whoa great info and info graphic. Adding this to my to do list!

  8. Sreekar says:

    Thanks for such an informative post. helps newbies like me in the blogging world!

  9. Vnod says:

    Thank you for the post. It really helps me. The redirection rules explained in Infographics is worth reading.

Leave a Reply

Your email address will not be published. Required fields are marked *