簡體   English   中英

htaccess mod_rewrite & apache2 不重寫正斜杠

[英]htaccess mod_rewrite & apache2 not rewriting forward slash

在我的 .htaccess 文件中,我使用的 mod_rewrite 適用於某些 Apache 2 服務器,但不適用於其他服務器。 例如,此重寫適用於所有 Apache2 服務器:

RewriteRule ^index-stormwatch.html$ index.php?action=stormwatch 

但是當我在 mod_rewrite 中用正斜杠替換連字符時,如下所示......

RewriteRule ^index/stormwatch.html$ index.php?action=stormwatch 

...一些 Apache 2 服務器會給我一個 404 錯誤(但不是全部)。 我的 mod_rewrite 是否寫得不正確,還是我需要編輯 httpd.conf 文件(或其他文件),以便 apache 接受正斜杠“/”? 所有提到的服務器都是 Apache 2/php5。

你能喜歡這樣嗎:

RewriteRule ^index/stormwatch\.html$ /index.php?action=stormwatch [NC,L,QSA]

那應該注意URI /index/stormwatch.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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