Are you scared of htaccess redirects? Don't be, they are easy! In this article I explain how to do a 301 and 302 redirect using Apache's .htaccess file.

To use a 301 redirect you need to have Apache and Apache's mod_rewrite installed.

What is a 301 Redirect?

A 301 redirect means the page is moved permanently. A search engine will update this link and give the existing page rank to the new url.

What is a 302 Redirect?

A 302 redirect means the page is moved temporary. A search engine will check the original link each time it crawls.

How to do redirects in .htaccess

In your .htaccess file place the following

#This is how you do a 301 redirect
redirect 301 /old-page.html http://domain.com/new-page.html

#This is how you do a 302 redirect
redirect 302 /old-page.html http://domain.com/new-page.html

Wow, that was easy!

Reference

Comments

I would have loved to know this two months ago! I'm currently renovating my website from plain html to Drupal and have lost my ranking. Since Drupal uses .htaccess of the hop, it'd have been super-easy to implement.
I found your website from your comment on the web designer wall, I've subscribed to your rss. Keep the tutorials coming!
Post Reply
Name *
Email (For verification & Replies)
URL
Code   
Submit Comment
Cancel
Show/Hide Comment form