简体   繁体   English

将网站URL从旧年份重定向到新年份

[英]Redirect site URLs from old year to new year

I've a WordPress site with tons of posts with permalinks containing the previous year '2015'. 我有一个WordPress网站,其中包含包含上一年“ 2015”的永久链接的大量帖子。 I want to redirect all the URLs containing that year to the new year '2016' with htaccess. 我想使用htaccess将包含该年的所有URL重定向到新年'2016'。

Example: 例:

From: 从:

http://www.my-domain.com/archive/slug-of-post-2015 http://www.my-domain.com/archive/slug-of-post-2015

To: 至:

http://www.my-domain.com/archive/slug-of-post-2016 http://www.my-domain.com/archive/slug-of-post-2016

您可以在.htaccess中将此重定向规则用作第一条规则(位于RewriteEngine On行下方):

RewriteRule ^(archive/.+)-2015(.*)$ /$1-2016$2 [L,NE,R=301]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM