How to redirect pages using a 301 redirect and the .htaccess file

301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It is very easy to implement and it should preserve your search engine rankings for that particular page.

If you have to change file names or move pages around, it’s the best option to preserve your rankings and incoming traffic. The code “301″ is interpreted as “moved permanently”.

Redirect to www

Create a .htaccess file with the below code, it will ensure that all requests coming in to will get redirected to
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]

Please REPLACE and with your actual domain name.

Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

Redirect a Single Page

Add the following text to your .htaccess file and upload to the base directory of your website.

Redirect 301 /oldpage.html /newpage.html

So, for example, you changed your domain, it would be:

Redirect 301

Redirect 301 /pagename.php

Leave a Reply

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