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
    rajesh
    # 12

    July 12th, 2007 at 5:00 am

    That helped me

  2. Gravatar
    metjay
    # 11

    June 5th, 2007 at 5:01 am

    “the browser reads the .htaccess file first”

    No browser can read a .htaccess file on a proper apache installation because they are never delivered out.
    .htacces files only are holding some server settings which are inherited in all subfolders of the containing one.
    So how does it redirect? The server makes a internal redirect, a kind of alias..

  3. Gravatar
    do
    # 10

    May 23rd, 2007 at 8:45 am

    Thanks!

  4. Gravatar
    Broadband Wireless Help
    # 9

    May 22nd, 2007 at 6:56 am

    Great info Thanks, should help PR leaks

  5. Gravatar
    Min Thu
    # 8

    January 29th, 2007 at 6:09 am

    301 redirection is just simply effective and useful. thanks for sharing!

  6. Gravatar
    David Paul
    # 7

    October 12th, 2006 at 2:25 am

    Not sure if it’s really related, but I’ve done a little article on how to use this redirect for scheduled maintenance so that the site appears to be down to everyone except for the person specified by an IP address so they can test it.

    http://www.newearthonline.co.uk/article/119

  7. Gravatar
    David Paul
    # 6

    October 6th, 2006 at 10:28 am

    I’ve done a guide on using htaccess files here:

    http://www.newearthonline.co.uk/article/68

  8. Gravatar
    Pimm
    # 5

    September 30th, 2006 at 4:38 pm

    Apache can deal with much more complicated redirections…
    See this article:
    http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteEngine
    Or google ‘RewriteRule’

  9. Gravatar
    Sam
    # 4

    September 26th, 2006 at 5:49 pm

    Works on windows server if Apache is installed.

  10. Gravatar
    bob
    # 3

    September 21st, 2006 at 4:52 pm

    lk

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

Post your comment