[英]htaccess mask for my url
我正在嘗試使用.htaccess屏蔽部分網址,但出現了幾個問題
我的網址是http://ristorantitalianetwork.com/ristorantitalianetwork.com/admin/
我想刪除重復的ristorantitalianetwork.com,所以我希望自己的網址像
http://ristorantitalianetwork.com/admin/
我用過
RewriteRule ^ristorantitalianetwork.com/([^/]*)$ ?q=$1 [L]
但這不起作用
您能幫我弄清楚如何解決這個問題嗎?
非常感謝
最好的祝福
你真的需要
RewriteRule ^/admin$ /ristorantitalianetwork.com/admin [L]
請記住,您應該向用戶顯示的URL是http://ristorantitalianetwork.com/admin/
,然后內部會將其轉換(重寫)為http://ristorantitalianetwork.com/ristorantitalianetwork.com/admin/
。
許多人認為,這並非相反。
您幾乎做到了! 但...
在您的問題中,您的重寫程序說,它應用於不以斜杠( /
)結尾的URL。 並且您說您想重寫一些URL ...,並給URL示例加上斜杠( /
)。
如果您需要進行真正的重定向(即瀏覽器中的URL更改):,這是很好的重寫:
RewriteRule ^ristorantitalianetwork\.com/([^/]*)/$ /$1 [QSA,R=301,L]
如果只需要內部重定向:
RewriteRule ^ristorantitalianetwork\.com/([^/]*)/$ /$1 [QSA,L]
請記住,URL 必須以斜杠( /
)結尾。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.