我正在使用Rewriterule以获得以下网址:http://www.myhost.com/var1/var2/
RewriteRule ^(.*)\/(.*)\/$ index.php?var1=$1&var2=$2 [L]
我想补充的是,当有人输入myhost.com/var1/var2(没有结束斜杠)时,它仍会转到同一页面。
有没有比这更好的方法?
RewriteRule ^(.*)\/(.*)\/$ index.php?var1=$1&var2=$2 [L]
RewriteRule ^(.*)\/(.*)$ index.php?var1=$1&var2=$2 [L]
答案 0 :(得分:0)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\/]*)\/([^\/]*)\/?$ index.php?band=$1&song=$2 [L]
注意结尾?