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, www.olddomain.com/page.html will becone www.newsite.com/page.html

Redirect all files with certain extension

Redirect from www to non-www location

Redirect to www location from non-www location

advertisement

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest updates, web design resources and tools.

You have Successfully Subscribed!

About The Author

    ADD YOUR COMMENT

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Receive fresh web design resources and SEO tips in your email by our weekly newsletter

You have Successfully Subscribed!