簡體   English   中英

在htaccess中從非www重定向到www時,如何從網址中刪除一個單詞?

[英]How to remove one word from the url while redirect from non-www to www in htaccess?

實際的問題是網站正在重定向到http://www.example.com/public/other-url

我需要移除

上市

網址中的單詞來投放,例如http://www.example.com/other-url

我正在使用以下代碼:

RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

也許這樣的事情可能會起作用:

RewriteCond %{REQUEST_URI} ^/public/other-url(.*)$
RewriteRule ^public/other-url(.*)$ /other-url$1 [R=301,L]

暫無
暫無

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

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