[英].htaccess RewriteRule issue on Windows Server
在Windows服務器上,我們運行Helicon Ape來運行.htaccess
規則並安裝了PHP。 我在根目錄下的.htaccess
文件中的以下行:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^test/(.*)$ test/handle.php?path=$1 [L]
</IfModule>
我在handle.php
文件中編寫了以下代碼。
echo $_GET["path"];
exit;
當我輸入任何像這樣的網址: http://mysite.com/test/test.zip
或http://mysite/test/FILENAME.EXT
不是打印FILENAME.EXT
它只是打印handle.php
作為輸出! 怎么了?
嘗試添加條件以防止重寫handle.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/test/handle.php$
RewriteRule ^test/(.*)$ test/handle.php?path=$1 [L]
</IfModule>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.