redirect php mysql url to other url
HI i need to redirect url (http://www.mysite.com/?1 upto any numbers ?2, ?3 etc) to other url http://www.othersite.com
Mean www.mysite.com/?2 to www.othersite.com
on not access like this page www.mysite.com/?1
any php code i need
rep开发者_JAVA百科ly back
It seems from your question you're ignoring the ?n
so it's simply:
index.php:
<?php
header("Location: http://www.othersite.com");
?>
try
if (count($_GET))
{
header('Location:http://www.myothersite');
}
You could do the following:
<?php
if(isset($_GET['1'])) {
header('location: http://othersite.com');
} elseif(isset($_GET['2']) {
header('location: http://othersite.com/otherpage');
}
//and so on
Later edit:
<?php
foreach($_GET as $key => $value) {
if(is_int($key)) {
header('location: http://othersite.com');
exit;
}
}
精彩评论