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
    santosh
    # 52

    August 27th, 2009 at 9:26 am

    is it possible to have
    Redirect 301 /oldpage2.html /folder/abc.html

    instead of the whole url.
    if yes then what are the changes that one need to do.

  2. Gravatar
    Rock
    # 51

    July 13th, 2009 at 12:57 pm

    I have tried to use the .htaccess method of a 301 redirect in my Content Management System running on Unix, but it is still not working?

    Any Suggestions?

  3. Gravatar
    Cornel M
    # 50

    June 28th, 2009 at 8:08 am

    How you can’t see the .htaccess file in your FTP client??? You must be see all files!

  4. Gravatar
    CORNx2
    # 49

    May 22nd, 2009 at 12:40 pm

    .htaccess files work for Apache web server installed on Linux, Mac or Windows

  5. Gravatar
    Kerwin
    # 48

    May 21st, 2009 at 9:57 pm

    very nice tip!

    but how come it aint working with mine too?

    i get 301 moved permanently even on my new domain. they are hosted on same server.

  6. Gravatar
    birthday sms
    # 47

    April 22nd, 2009 at 5:32 am

    I have used this method before and i try to use it now, but it seems not working…

    I have to find why.

    I want to redirect old joomla pages to new static html pages

  7. Gravatar
    Website Design Web Development Company
    # 46

    March 19th, 2009 at 7:52 am

    Great tips for the newbies

  8. Gravatar
    Lots Of Freebies
    # 45

    January 12th, 2009 at 6:42 pm

    Nice and clear cut tutorial. Very easy to follow.

  9. Gravatar
    Cristi
    # 44

    January 9th, 2009 at 10:17 am

    The browser doesn’t read the .htaccess file. The server does that.

  10. Gravatar
    AK Designs
    # 43

    December 3rd, 2008 at 8:38 am

    Fantastic you cut out all the rubbish that normally surrounds 301 redirects. thanks.

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

Post your comment