How to redirect more than one links
I need to redirect some of my html pages to corresponding php pages.
That means if a user comes from any referring site to my www.example.com/sample.html pag开发者_如何学Goe, he should be redirected to the www.example.com/sample.php page without showing the html page.
I need to do this for 3 pages. How can I do this ? Please help me :)
You can create a .htaccess
file and put it in the root of your web server. It should contain the following:
Redirect 301 /sample1.html http://www.example.com/sample1.php
Redirect 301 /sample2.html http://www.example.com/sample2.php
Redirect 301 /sample3.html http://www.example.com/sample3.php
You can use .htaccess file for redirecting you file properly with
include cose in .htaccess
RewriteEngine on RewriteRule ^(.*).html$ $1.php
or in other way
use php like
echo "window.location='\www.example.com/sample.php'\";
Hope i will help you in better way
Create .htaccess with the following line:
Redirect 301 ^(.*).html$ $1.php
Try this...
<?php
header('Location: www.example.com/sample.php');
?>
精彩评论