How to Use 301 .htaccess Redirect?

To create a .htaccess file, open notepad, name and save the file as .htaccess (there is no extension).

If you already have a .htaccess file on your server, download it to your  desktop for editing.

Place this code in your .htaccess file and Save the .htaccess file and Upload this file to the root folder of your server.

If you want to redirect old page name to new page name. Do following.

Redirect 301 /oldpage.html

Other ways to implement the 301 Redirect:

To redirect ALL files on your domain use this in your .htaccess file if you are on a unix web server:

redirectMatch 301 ^(.*)$
redirectMatch permanent ^(.*)$

Redirect Domain with WWW.

If you need to redirect to and you’ve got mod_rewrite enabled on your server you can put this in your .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$$1 [R=permanent,L]

Or you can use this one too:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]


Follow HNW on TwitterTwitter, Become a fan on FacebookFacebook and Subscribe to RSSRSS.

You may also like


  1. yes…this information is I am searching on the web …content is very easy to understand …Keep it up!! good work

  2. I’ve made my first CSS 3 – HTML 5 websites and i love it! We can make a border radius, no need anymore to do it in Photoshop!

  3. 1 of the very most useful pieces of important information I offer to valued clients is concerning web-site usability. You will discover so many specialists out there trying to get ranked, but their web sites tend to be crappy. You need to make many changes to get ranked and stay ranked.

  4. This is a really good read for me. Must admit that you are one of the coolest bloggers I ever saw. Thanks for posting this informative article.

Leave a Reply

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