繁体   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