我在笔记本电脑上运行的wampsever上创建了一个.htacess文件。下面的代码在我的.htacess文件中,页面显示没问题,只是我得到了变量。
RewriteEngine on
#Request routing
RewriteRule ^([a-zA-Z0-9_-]*)/([a-zA-Z0-9_-]*)/([0-9]*)$ index.php?ID=$1&Code=$2&v=$3 [nc,qsa]
# Rewrite for GetSimDate.php?id=1&title=Title-Goes-Here
RewriteRule ^GetSimDate/([0-9a-zA-Z_-]*)/([0-9a-zA-Z_-]*)$ GetSimDate.php?ID=$1&Code=$2 [NC,qsa]
在我的php文件中,我试过
Var_dump($_GET)
和echo $_GET['ID']
都是空的
我的网址是localhost / myfolder / GetSimDate / 1212 / hjnef
答案 0 :(得分:0)
尝试:
RewriteEngine on
Options -MultiViews
# Rewrite for GetSimDate.php?id=1&title=Title-Goes-Here
RewriteRule ^GetSimDate/([0-9a-z_-]*)/([0-9a-z_-]*)$ GetSimDate.php?ID=$1&Code=$2 [NC,QSA,L]
#Request routing
RewriteRule ^([a-z0-9_-]*)/([a-z0-9_-]*)/([0-9]*)$ index.php?ID=$1&Code=$2&v=$3 [NC,QSA,L]