← Back to Blog

301 .htaccess Redirect

Sep 15, 2006 21 Comments

After the implementation of WordPress, some of the URLs and paths on this site have changed. To prevent getting 404 File Not Found error (traffic coming from links, bookmarks and search engines), I use .htaccess 301 redirect. Htaccess redirect is better than the meta refresh or redirect tag because there is no delay as the browser reads the .htaccess file first. Here is how it works.

Go to your site’s root folder, download the .htaccess file to your local computer and edit it with a plain-text editor (ie. Notepad). If you are using FTP Client software and you don’t see any .htaccess file on your server, double check your setting and make sure you have turn on invisible / system files.

To Redirect Certain Page(s):

Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html Redirect 301 /oldpage2.html http://www.yoursite.com/folder/

To Redirect Entire Site:

Redirect 301 / http://www.new-site.com/

Trendy Omni Beanbag

Collapse All Expand All

21 Comments… +add yours?

  1. Feb 03, 2010 7:12 am

    Muzika

    Very useful tutorial, but maybe you could add more methods for 301 redirect …

  2. Feb 17, 2010 9:52 am

    Weddings Fashion

    man i even can understand the function of httaccess :)

  3. Feb 17, 2010 9:52 am

    Weddings Fashion

    sorry i want to say “man i even can’t understand the function of httaccess :)

  4. Feb 21, 2010 12:40 pm

    euro sport news

    Thank you for this useful turtorial. As others i think you can put more example about .htaccess.

    Good works.

  5. Feb 24, 2010 2:46 pm

    HighPoint SEO

    Good tutorial on the basics, but can you supply the entire code? Does this rewrite condition need to present for the code to work?

    (RewriteEngine On

    RewriteCond %{HTTP_HOST}

    redirect 301 / http://URL.com)

  6. Feb 27, 2010 6:40 pm

    Jake Wright

    Great tutorial, nice and simple. :)
    First tutorial I’ve found which works for redirecting my old domains properly.

  7. Mar 03, 2010 5:47 am

    hilikus

    this is great,

    if you have more than one site on your server and want to apply it to all, then this code also works in /etc/apache2/apache2.conf

    if the change in url is only temporary, then use 302 instead on 301, this will make sure search engines keep your original url indexed.

    I use this technique on my Xbox Gaming Website – theLostnFound.co.uk

  8. Mar 05, 2010 11:50 am

    Jeff

    Yes this is *exactly* what l was looking for! Thanks so much for your help!

  9. Mar 17, 2010 5:30 pm

    Nathan W. Bingham

    Thanks for this tutorial. Quick question though. How would you code the .htaccess to get it to redirect all http://domain.com/?tag=sampletag to http://domain.com/tag/sampletag?

    Thanks. I’ve hunted all over the place and not found the answer.

  10. Apr 02, 2010 1:00 am

    hr-software-solutions.com

    thanks great simple to understand post

  11. Jun 06, 2010 2:28 am

    polskie biuro ksiegowe

    This is what I need – thank you. Really simple, easy to use and quick!

  12. Jul 09, 2010 9:56 pm

    arya

    Can you please add more tutorial for 301 redirect old domain name to new domain name ?

  13. Jul 12, 2010 11:56 pm

    SEO Service UK

    Can u provide me code for html pages?
    how to write code for redirect?

  14. Jul 14, 2010 9:24 am

    design

    yes it is very important to redirect the pages for seo

  15. Jul 15, 2010 6:56 am

    web development

    Thanks for shoving a useful information on 301 redirection. It will helps many users who wants to redirect to new domain.

  16. Jul 15, 2010 2:36 pm

    email disclaimer

    Nice, i was thinking of adding the 301 redirect to my htaccess, and you’ve really simplified it.

  17. Jul 20, 2010 5:44 am

    Amit

    Nice blog it is maintained good. Thanks for the useful information on 301 redirection.

  18. Jul 21, 2010 2:15 am

    Seo

    You may use 301 or, now you can use google webmaster tools. With this tool you can, change your site. I think if you use win server, google webmaster tool is better.

  19. Jul 23, 2010 6:05 am

    anuj

    thanks for such nice post
    regards
    Anuj
    http://www.winservers.co.in/

  20. Aug 04, 2010 11:11 pm

    Sohbet

    Thanks a lot to help me

  21. Aug 16, 2010 1:08 am

    ramesh

    Thanks you very much i was looking for this info

Write Your Comments

Reply in this thread

  • No rude or spam comments
  • Allowed HTML tags:
    blockquote, a, em, strong, strike
  • Use HTML entities to output code as text
    (ie. < = &lt; > = &gt;)