在我的规则中,我有..
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&submenu=$2&info=$3&id=$4 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&submenu=$2&info=$3 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&submenu=$2 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [QSA,L]
这对我来说似乎有点笨重并且重复了很多东西,关于我如何缩短它的任何想法?
我可以设置“全局”条件吗?我可以有一个这样的规则来捕获它下面的所有规则吗(我不在乎它是否通过空变量发送)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule **clever stuff here** index.php?page=$1&submenu=$2&info=$3&id=$4 [QSA,L]
所以它会捕获
domain.com/a/b/c/d 和 domain.com/a/b/c 和 domain.com/a/b 和 domain.com/a
答案、想法、沉思和存在论都受到赞赏......