真正的网址格式是
http://localhost/myfolder/index.php?url=login/register&step=1
在mod重写之后我得到了
http://localhost/myfolder/login/register/step/1
一切都很好,但我如何才能获得php文件中step的值。如果我$_GET['step']
那么我什么都没得到。
我的htaccess
Options -MultiViews
# turn rewriting on
RewriteEngine On
# When using the script within a sub-folder, put this path here, like /mysubfolder/
# If your app is in the root of your web folder, then please delete this line or comment it out
RewriteBase /mybb/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)/(.*) index.php?url=$0&step=$2 [L,QSA]
答案 0 :(得分:0)
将您的规则更改为:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?)(?:/(step)/([0-9]+))?/?$ index.php?url=$1&$2=$3 [NC,L,QSA]