簡體   English   中英

.htaccess RewriteRule-本地主機和1and1上的不同行為

[英].htaccess RewriteRule - different behavior on localhost and 1and1

我的.htaccess文件具有以下行:

RewriteRule ^profile/(.*)$ profile.php?username=$1 [L]

當我轉到http://localhost/blah/profile/name (我正在使用XAMPP)時,在profile.php中我可以說:

$user_name = $_GET['username']

這很好。 但是,當我將其部署到1and1服務器並轉到http://blah.com/profile/name ,未設置$_GET['username'] 為什么表現不同?

嘗試關閉Multiviews

Options -Multiviews

啟用多視圖后,mod_negotiation將嘗試將請求(以及其PATH INFO)與現有文件進行匹配。 這樣該模塊將看到/profile/something ,然后看到有一個/profile.php ,只需將請求發送到/profile.php ,就完全繞開了mod_rewrite和您的規則。

暫無
暫無

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

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