我正在尝试为我的.htaccess做一个rewriteRule
RewriteEngine On
RewriteRule ^/LoginUser(.*)$ src/core/index.php?url=$1 [L]我尝试捕获LoginUser之后的所有内容,因此是组(.*),并在$1中使用它。
目前:
Input: http://foobar.com/LoginUser/Account/cat
Output: http://foobar.com/src/core/index.php?url=/LoginUser/Account/cat但我期待的是:
Output: http://foobar.com/src/core/index.php?url=/Account/cat我的正则表达式有什么问题?一定是出了什么问题,我的头一直撞在墙上,还是没有反应。如果有人能给我指明正确的方向,我将不胜感激。
发布于 2020-05-25 23:00:44
/,所以你想要的规则是: RewriteRule ^LoginUser(.*)$ src/core/index.php?url=$1 [L] Input: http://foobar.com/LoginUserToTest/Account/cat
Output: http://foobar.com/src/core/index.php?url=ToTest/Account/cat为了避免这种情况,您需要的规则是:
RewriteRule ^LoginUser/(.*)$ src/core/index.php?url=/$1 [L]https://stackoverflow.com/questions/62004029
复制相似问题