簡體   English   中英

.htaccess Windows Server上的RewriteRule問題

[英].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.ziphttp://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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM