301 Redirect Using .htaccess


Sometimes we need to change the URL of the page. Changing the URL is simple but there are few risks in this. If you are changing the URL of page which is popular and indexed in search engine, you are going to loose the visitors and ranking both. So, you should always do this process with extra care. Once you have changed the URL, redirect the old URL to the new to pass visitors and ranking both. This redirect should be 301 redirect. 301 redirect tells search engines that web page has been moved permanently to the new web address.

301 Redirects

In this post, we will see how to do proper 301 redirection using htaccess file.

Where is .htaccess file on the server?

.htaccess file is located at the root folder of your website. You can easily find the program from any FTP program or file browser of cpanel. Be sure to show hidden files if you are unable to find this file on your website’s root directory.


Note: Take a backup of the file before any kind of changes.

Redirect single file

If you only want to redirect a single file, just add this line in the .htacess file.

Redirect an entire site to new domain

This way of redirection also preserves old links. It means, will becone

Redirect all files with certain extension

Redirect from www to non-www location

Redirect to www location from non-www location


Written by Deepanker

Deepanker Verma is the founder of Techlomedia. He is a tech blogger, developer and gadget freak.

One Comment

Leave a Reply
  1. Hey Deepanker!!!! you write it well. I really don’t know about it. I thought it can only be done when we buy domain.

Leave a Reply

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


Detect Hidden Malware and Repair System With Hijack Hunter


5 Services to Make Money from Your Twitter Account