簡體   English   中英

.htaccess從舊站點重定向到新站點

[英].htaccess redirect from old site to new site

如何通過htaccess將舊鏈接重定向到新站點。 我有以下代碼:

RewriteEngine on

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

Redirect 301 /2013/08/ http://www.mysite.co.uk/whats-on/news/

附件正確嗎?

不要將mod_alias規則與mod_rewrite規則混合使用,並在通用重定向之前保留特定的重定向。

RewriteEngine on

RewriteRule ^2013/08/ http://www.mysite.co.uk/whats-on/news/ [L,R=301]

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

暫無
暫無

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

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