如何通过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/
是附加的正确吗?
答案 0 :(得分:0)
请勿将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]