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.
0 comments:
Post a Comment