N.Design Studio

301 .htaccess Redirect Trick

Filed in: Tricks & Tips Jump to comments

After the implementation of WordPress, you should notice some of the URLs and paths on this site are different. To prevent getting 404 File Not Found error (traffic coming from links, bookmarks and search engines), I used this .htaccess 301 redirect trick I found. This way is better than meta refresh or redirect tag because there is no delay as the browser reads the .htaccess file first. However, it is only available to Linux server (doen’t work on Window server). Here is the trick.

Go to your site’s root folder, download the .htaccess file to your local computer and edit it with a plain-text editor (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/

52 comments so far

Pages: « 6 5 [4] 3 2 1 » Show All

  1. Gravatar
    Noha
    # 32

    October 9th, 2008 at 6:00 am

    Hi all,
    i am trying to create a reserved section for a group of users to view extra pages of the blog like extra services so they have to get through a login page to access their part of the blog … i want to get them authenticated through ssl/https how can i do that with wordpress.

    thanks in advance

  2. Gravatar
    Dom
    # 31

    October 6th, 2008 at 1:24 pm

    I have to do a redirect, I need to change only the folders.

    www.mysite.com/12345/samehtml.html
    to
    www.mysite.com/54321/samehtml.html

    Does anyone know how to do this.

  3. Gravatar
    bilal
    # 30

    October 5th, 2008 at 10:19 am

    how do we redirect 404 pages to successfull 301 homepage ??
    so that we dont lose pagerank.

  4. Gravatar
    CLS
    # 29

    September 26th, 2008 at 10:01 am

    Thanx indeed.

    And Slots Guide

    “I’ve tried your code and it seems to be working, but I’m not sure that it is good for the SEs (Google, Yahoo, MSN). I’ve seen another code:”

    The example given here a plain and simple 301 redirect is perfecto for SE’s

  5. Gravatar
    Leena Ajwani
    # 28

    September 14th, 2008 at 3:08 pm

    i tried this

    redirect 301 /index.htm1 http://www.convert2xhtml.com/

    but it does not works not sure why?

  6. Gravatar
    Michael
    # 27

    September 7th, 2008 at 3:27 pm

    Hello, regarding the form part, I have tried it and I am having trouble with it. First of Your tutourial was fantastic. Just where do I select were the email address goes?

  7. Gravatar
    Valerie
    # 26

    September 4th, 2008 at 3:41 pm

    Thanks so much for this! I kept finding such complicated code that didn’t seem to work for me, but this did the trick. I just needed to haul visitors from one to the other.

  8. Gravatar
    Hotcars
    # 25

    August 19th, 2008 at 7:52 pm

    Google will find the header info sent and they will see the 301 redirect. I dont know if its good. I know that if site is managed using cpanel its possible to make a nice 404 redirect to homepage without 301 or any other redirect things. There is 404.shtml file as I remember. Anyway thanks for this tip as it may be useful for those who don’t have cpanel.

  9. Gravatar
    şapka
    # 24

    July 24th, 2008 at 9:13 am

    Great info Thanks, should help PR leaks

  10. Gravatar
    Slots Guide
    # 23

    July 23rd, 2008 at 3:57 am

    Hi

    I’ve tried your code and it seems to be working, but I’m not sure that it is good for the SEs (Google, Yahoo, MSN). I’ve seen another code:

    RewriteEngine on
    # index.php to /
    RewriteCond %{THE_REQUEST} ^[A-Z]{3, 9}\ /.*index\.php\ HTTP/
    RewriteRule ^(.*)index\.php$ /$1 [R=301,L]

    What is your recommendation.
    Thanks

Pages: « 6 5 [4] 3 2 1 » Show All

Post your comment