簡體   English   中英

301重定向適用於鏈接,但不適用於子域

[英]301 Redirect working for links, but not subdomain

最近將站點從子域移到了根域的子目錄中。

http://blog.domain.comhttp://domain.com/blog

我將其放在http://blog.domain.com .htaccess中,因此,將訪問具有舊URL的文章的用戶。

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://blog.\domain\.com
RewriteRule .* http://domain.com/blog [R=301,L]

我無法弄清楚如何將http://blog.domain.com重定向到http://domain.com/blog 上面的代碼段不這樣做。 任何見解將不勝感激!

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^blog\.domain\.com$
RewriteRule ^(.*)$ http://domain.com/blog/$1 [L,R=301]

暫無
暫無

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

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