我怎么能意识到这一点:
当用户进入
时mysite.com/index.php?g=123
他将被重定向到mysite.com/123。
同样的任何其他内在价值。例如:mysite.com/?g = 456> mysite的/ 456; mysite.com/?g=789> mysite的/ 789;等等 我试过了,但我知道这种方式是错误的:
<?php
$g = checkValues($_REQUEST['g']);
if($g)
{
header("Location: index.php/$g");
}
?>
谢谢!
答案 0 :(得分:0)
替换:
$g = checkValues($_REQUEST['g']);
通过这个
$g = checkValues($_GET['g']);
答案 1 :(得分:0)
没有对此进行测试,但应该这样做 将此代码放在.htaccess文件中
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{QUERY_STRING} g=(\d+) [NC]
RewriteRule ^ mysite.com/index.php/%1 [R=301,L]
</IfModule>