← Back to Blog

301 .htaccess Redirect

Sep 15, 2006 43 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/

Collapse All Expand All

43 Comments… +add yours?

  1. Feb 03, 2010 @ 07:12:19


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

  2. Feb 17, 2010 @ 09:52:09

    Weddings Fashion

    man i even can understand the function of httaccess :)

  3. Feb 17, 2010 @ 09:52:43

    Weddings Fashion

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

  4. Feb 21, 2010 @ 12:40:30

    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 @ 14:46:39

    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 @ 18:40:34

    Jake Wright

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

  7. Mar 03, 2010 @ 05:47:33


    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:05


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

  9. Mar 17, 2010 @ 17:30:08

    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 @ 01:00:45


    thanks great simple to understand post

  11. Jun 06, 2010 @ 02:28:21

    polskie biuro ksiegowe

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

  12. Jul 09, 2010 @ 21:56:36


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

  13. Jul 12, 2010 @ 23:56:38

    SEO Service UK

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

  14. Jul 14, 2010 @ 09:24:41


    yes it is very important to redirect the pages for seo

  15. Jul 15, 2010 @ 06:56:55

    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 @ 14:36:30

    email disclaimer

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

  17. Jul 20, 2010 @ 05:44:08


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

  18. Jul 21, 2010 @ 02:15:11


    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 @ 06:05:24


    thanks for such nice post

  20. Aug 04, 2010 @ 23:11:59


    Thanks a lot to help me

  21. Aug 16, 2010 @ 01:08:29


    Thanks you very much i was looking for this info

    • May 03, 2011 @ 06:52:33


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

  22. Sep 26, 2010 @ 02:33:15


    i got i redirect loop with

    Redirect 301 / http://www.new-site.com/
    what can me do ?

  23. Oct 23, 2010 @ 09:03:00


    i got this code in somewhere

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

    is this “Options +FollowSymlinks” necessary?

  24. Nov 06, 2010 @ 13:38:00



    Has now been implemented into my .htaccess

  25. Nov 29, 2010 @ 13:19:22


    20 examples of .htaccess http://thetech.com.ua/?p=1243

  26. Mar 02, 2011 @ 16:07:30


    Short and understandable.

  27. Mar 15, 2011 @ 12:43:13

    Website Design

    Thanks for sharing. I have a question however, when i create a redirect for /index.php http://www.example.com/ , the index.php is still present when i click on a link for index.php? Is there a better way to rewrite your index files, so there is no duplicate content indexed in google? (ie, site.com/index.php and site.com/)

  28. May 06, 2011 @ 14:35:52


    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.

  29. Sep 24, 2011 @ 01:50:20

    Mayur Shah

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

    Is this generic code to use for more then one old pages to re-direct on new page?

  30. Sep 24, 2011 @ 01:51:56



    I was looking this articles and seems my solutions here but can anyone let me know if I have more then one pages to re-direct what should I have to do simple add all pages in htaccess file?

    Thank you

  31. Jan 23, 2012 @ 00:36:50


    thanks , its work….i have use it on my, after one day search i find it.

  32. May 02, 2012 @ 00:55:04

    Youval Katz

    That was very Useful for me, Thanks

  33. May 11, 2012 @ 12:44:38


    Does anyone know how it works with images? Can you use this redirect method for images like so:

    Redirect 301 /pic.jpg http://www.yoursite.com/folder/pic.jpg

    I know there are other alternatives to fix my problem, but simply need a yes or no answer. Thanks guys

  34. May 15, 2012 @ 02:01:56

    Alex Zagoumenov

    Thanks guys! That’s the simplest and the most concise article on 301-redirects through .htaccess file I’ve ever seen. Thanks for being straight and to the point.

  35. May 29, 2012 @ 13:00:57


    Hi, i need a huge HELP from you guys,

    we have an old site .NET and .COM
    all content which is now on .NET use to be like a mirror on .COM but main domain always was and still is .COM

    on .COM we have new similar content but completely new structure of links and database.
    we made some redirect table which redirects all old indexed content from OLD .COM to new similar pages on NEW.COM

    link for .NET is http://app.adriahome.com/hotels-dubrovnik-old
    if you change .NET for .COM you will be redirected to NEW.COM
    here: http://app.adriahome.com/hotels-dubrovnik-new

    My question is:
    if .NET is like mirror as OLD.COM if I rewrite complete domain .NET to .COM will be like double redirect to the NEW.COM with 301 redirect rule
    WILL my pages NEW.COM will be penalized for that?

    i’m using:
    rewritecond %{http_host} ^www\.adriahome\.co\.uk [nc]
    rewriterule ^(.*)$ “http\:\/\/www\.adriahome\.com” [R=301,L]

    this is because http://www.adriahome.co.uk/destinations-croatia and lot of content onb redirected domains was already indexed like mirror same as http://www.adriahome.com/destinations-croatia

    Do you think is better to made conversion table directly from .NET to NEW.COM ?

    Thank you for any feedback!


  36. Jun 13, 2012 @ 04:15:31


    From trial and error eventually found that with the simple command for redirecting the entire site,
    Redirect 301 / http://www.new-site.com/

    each sub page will also redirect to the sub page if you have the same file structure. So for example in our case


    redirected to:


    and so on for all our pages on the old domain.

    This ensures your SEO value passes from each individual page to each new individual page rather than everything into the home page.

  37. Jun 26, 2012 @ 02:36:23


    I did some research and found Therese different answers regarding with 301 redirect. Should i use the following codes:

    RewriteEngine on
    RewriteCond %{QUERY_STRING}


  38. Oct 16, 2012 @ 09:29:37

    Conversion Optimization

    Hey guys! straight to the point; rather, straight to the solutions – good job.
    I think for small websites, these are the only 2 you’ll need… and hopefully they weren’t using something like “index.php?page=contact” to call a page!

  39. May 17, 2024 @ 03:00:36


    Although few in number and expressing literal objects, pictograms and ideograms are nonetheless the basis on which all of the more complex characters resembling associative compound characters (会意字/會意字) and phono-semantic characters (形声字/形聲字) are formed. That is, pictograms extended from literal objects to take on symbolic or metaphoric meanings; typically even displacing using the character as a literal time period, or creating ambiguity, which was resolved by way of character determinants, more commonly but much less accurately generally known as “radicals” i.e. idea keys in the phono-semantic characters. The characters carved on the tortoise shells and animal bones then included the prediction time, title of the diviner, affairs divined and even the results of the divining. Mainland China adopted simplified Chinese language characters in 1956. They are additionally used in Singapore and Malaysia. A pleasant piece of jewelry, a box of chocolates, or an attention-grabbing ebook about China will all make great gifts.

    Primarily based on Rudyard Kipling’s book, Disney adapted the story for the animated display screen in 1967. Within the Disney film, Kaa, a snake, is portrayed as a villain; however, Kipling’s e-book exhibits Kaa as more of a mentor to Mowgli. Writer Robert Kirkman is the author and creator of the comic ebook series “The Walking Useless.” Now in its ninth season, Kirkman remains one of the govt producers on the show and still writes many episodes. Strive to recollect a few phrases in Chinese language to point out you care and wish her to like you. Nonetheless, you may have to bear in mind few issues, which might make or break your relationship with a Chinese lady. Contemplating this, the gap between the lower and the very best potential price is huge, but the average cost (the typical quantity men spend on courting and meeting their Chinese girlfriends of their metropolis no less than a few times earlier than they decide to marry them) is about $6,000. No matter what you are looking for: assembly new pals, a soulmate or just beginning a brand new critical lengthy-time period relationship with native singles near you.

    You would possibly assume you deserve a spot at a local trivia evening, but do you actually? It is all properly and good that westerners assume they will simply marry for themselves however at the top of the day your loved ones is still there and you grew up with your family so even for those who don’t go to them otherwise you estrange your self from them it doesn’t imply you might be free from them. Many people might think that gravity makes your nose and your ears look greater as you get older, however they couldn’t be extra wrong. While a few of our answers may appear like a given, others might require you to make use of our hints and to do a little considering. So Filipinas are sensual and passionate (like a hot-blooded Spanish Latina) however she might even be blissful-go-fortunate and simple going (like their American counterparts). Like your peas or not, there’s lots of legumes you might be certain to take pleasure in. Some factors appear to be universal, but there are peculiarities in interaction with Chinese language. There are quite a few stores and internet websites on the internet that provide the ability of designing an online site [url=https://www.youtube.com/c/chnlove]chnlove[/url] for you. Even when you aren’t paying consideration, you are more likely to be learning a random fact or tidbit of data.

    Unknowingly and all through our lives, we’re filled with bits of trivial info that somehow stick in our brains. For more info concerning the Chinese Furnishings, please feel free to contact us! The historical Chinese are satisfied that there are two sides to each individual – the Yin, the feminine or receptive facet and the Yang, the masculine or assertive aspect. Lima sits on the Pacific coast side of the continent and boasts a well-preserved colonial downtown area. Covering an area of almost 32,000 sq. miles, Lake Superior is taken into account the most important freshwater lake on the planet. You will discover your mate sitting in UK from any a part of the world. It is usually one of the 5 Nice Lakes positioned in the north-central part of the United States. Hiking alongside the good Wall of China, in Jiankou specifically, is a well-liked activity among Chinese ladies. Allied sea and air superiority meant that supplies could not reach them without nice problem (typically by submarines), and their redundant garrisons could not be switched to different fronts. So, when they started dating a man, it just meant that she noticed him as a possible life companion moderately than simply relationship companions.

  40. May 18, 2024 @ 03:59:43

    Pasang Iklan Rumah

    Can’t find any good article like this, thank you. Regards, IDProperti.com | Pasang Iklan Properti

  41. May 23, 2024 @ 10:55:36


    [url=https://gates-of-olympus-1000.fun/]gates of olympus 1000 слот[/url]

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;)