301 .htaccess Redirect

To prevent getting 404 File Not Found error (traffic coming from links, bookmarks and search engines) when URLs and paths on site have changed, 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/

Redirect with dynamic parameters

For example redirecting http://www.domain.com/brands/sony/sonys-new-s-frames-with-avchd-video-playback/ to http://www.domain.com/sony/sonys-new-s-frames-with-avchd-video-playback/

RewriteRule ^(.*)brands/([a-z_A-Z0-9\\-]+)/([a-z_A-Z0-9\\-]+)/$ http://%{HTTP_HOST}/$2/$3/ [R=301,L]
RewriteRule ^(.*)([a-z_A-Z0-9\\-]+)/([a-z_A-Z0-9\\-]+)/([a-z_A-Z0-9\\-]+)/$ http://%{HTTP_HOST}/$2/$3/ [R=301,L]

About the Author: SGH

At the same time, I can’t think of anything more satisfying than sitting in front of TV, eating take-away, lights down low, in my pyjamas and watching crap on TV. Basically, I strive to live a balanced life. Fun. Serious. Fast. Slow. Brainy. Bimbotic. Intense. Lazy. You get the drift.

1 Comment: + Add Comment

  • Thanks for showing a useful information on 301 redirection.

Leave a comment

Click to refresh

Please login to Automatic Backlinks and activate this site.

Subscribe to newsletter

Sign up with your email to get updates about new resources releases and special offers.