.htaccess中的以下重写规则无法按预期工作。它不会从重写规则中排除/FileShare子目录,尽管它应该:
RewriteEngine on
RewriteCond %{REQUEST_URI} /([0-9]+)
RewriteCond %{REQUEST_URI} !/FileShare
RewriteRule ([0-9]+) Router.php?id=$1 [QSA]
# Still call existing files (for css, gfx etc.)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Redirect every other file call
RewriteRule ^.*$ Router.php [QSA]
# Redirect every other call even without file name in it
RewriteRule ^$ Router.php [QSA]期望的结果是
/Command/Method -> Router.php
/Command/Method/123 -> Router.php?id=123
/FileShare/Command/Method -> Router.php
/FileShare/Command/Method/123 -> Router.php (without stripping 123 and without id=123)非常感谢您的帮助
发布于 2020-04-30 22:39:02
上面的脚本似乎确实起作用了。问题是Router.php没有正确地做出反应。
https://stackoverflow.com/questions/61454196
复制相似问题