[英]Wordpress Posts Redirect to a new folder
I have created a new site with the same post structure of the old one and I would like to redirect all the posts from the old to the new one. 我创建了一个具有与旧站点相同的帖子结构的新站点,我想将所有帖子从旧站点重定向到新站点。
The old site is something like:
http://www.website.com/site1/ The old site is something like:
http The old site is something like:
//www.website.com/site1/
And the new site is something like:
http://www.website.com/site2/ And the new site is something like:
http And the new site is something like:
//www.website.com/site2/
Same domain. 同一域。
The folder and post structure are the same. 文件夹和帖子结构相同。 So a sample posts on site 1 ( http://www.website.com/site1/post1/ ) would be redirected to site 2 ( http://www.website.com/site2/post1/ ).
因此,站点1( http://www.website.com/site1/post1/ )上的示例帖子将被重定向到站点2( http://www.website.com/site2/post1/ )。
How can I redirect all posts on my htaccess? 如何重定向htaccess上的所有帖子?
Thank you. 谢谢。
You can do that by this rewrite rule: 您可以按照以下重写规则进行操作:
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^site1/(.*)$ /site2/$1 [R=301,NC,L]
If you don't want external redirect (no change of URL in browser) then remove R
flag: 如果您不希望外部重定向(浏览器中的URL不变),则删除
R
标志:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.