[英]mod_rewrite $1 gives me the wrong value
我在/ backend文件夾中有以下.htaccess:
RewriteEngine On
RewriteBase /backend
RewriteRule ^(.*)\.php$ index.php?path=$1 [L]
當我訪問http://mysite.com/backend/test/pages/dashboard.php
$ _GET ['path']時,返回字符串“index”而不是“test / pages / dashboard.php”。
我究竟做錯了什么? 我無法弄清楚這一點。
通過在另一個規則之前添加以下規則來解決此問題。
RewriteRule ^index.php$ - [L]
特里指出:
在perdir上下文中,重寫引擎遍歷.htaccess文件,直到它獲得干凈的傳遞。
換句話說,mod_rewrite重寫了兩次url,因為第一次重寫的結果也與規則匹配。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.