Monday, February 1, 2010

htaccess 302 redirect - How to do 302 Redirection in Apache Server



htaccess 302 Redirect In my previous post What is HTTP 302 Redirect - Temporary Redirection I have explained about the importance of 302 redirection in SEO.

Now its time to know how we can do the 302 redirect for our website.

How to do 302 redirect using htaccess for Apache?

Open a notepad and paste the below mentioned lines.

RewriteEngine on

RewriteCond %{HTTP_HOST} ^yourdomain\.com
RewriteRule ^(.*)$http://www.yourdomain.com/$1 [R=302,L]
In place of 'yourdomain' please use your domain name.


Now save the file as .htaccess. Place the .htaccess file into your root folder where your site index file is.

That’s it. You have done it!

How to set up 302 Redirect in a Server Script?

The script has to generate a 302 header.

Redirecting a page in PHP
<?php
header("Location: http://www.yourdomain.com/");
exit();
?>

Again here in place of 'yourdomain' please use your domain name.

We have done with 302 redirect for your website.

If you find this post more useful then, Please

Subscribe to this Blog:

Click here to Subscribe to FREE email updates from "Internet Marketing Insights"

Stumble ThisFav This With TechnoratiAdd To Del.icio.usDigg ThisAdd To RedditAdd To FacebookAdd To Yahoo

People who read this post also read :





0 comments:

 

Creative Commons License

Blog directory Internet Marketing Insights - Blogged Internet Blogs - Blog Catalog Blog Directory