简体   繁体   English

动态RedirectMatch Wordpress永久链接更改

[英]Dynamic RedirectMatch Wordpress Permalink Change

Have a wordpress blog in an older wordpress installation located under the /blog directory. 在/ blog目录下的较旧的wordpress安装中,有一个wordpress博客。 These files have a permalink naming convention of 0000-name-of-file.html. 这些文件的永久链接命名约定为0000-name-of-file.html。 The new wordpress blog location is category/blog, and the new permalink file name convention is name-of-file-0000.html 新的wordpress博客位置为category / blog,新的永久链接文件名称约定为name-of-file-0000.html

I was thinking that I would be able to create a rule to redirect/rewrite the name dynamically. 我以为我可以创建一条规则来动态重定向/重写名称。 But this does not work. 但这是行不通的。

Anyone have any thoughts on what I am doing wrong. 任何人对我做错了什么都有想法。

RewriteRule ^/blog/([0-9]{4})-(\d+)\.html $http://www.xyz.com/$2-$1.html [R=302,L]

您可以在blog/.htaccess尝试将此规则作为第一条规则:

RewriteRule ^([0-9]+)-(.+)$ /category/blog/$2-$1 [R=302,L]

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

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