简体   繁体   English

正则表达式和重定向插件

[英]Regex and Redirection Plugin

My blog was originally set up as follows: /blog/ 我的博客最初设置如下: /blog/

For some time, it has been as follows: /posts-2/ 一段时间以来,它一直是: /posts-2/

I need to know an expression to direct from /blog/ to /posts-2/ 我需要知道一个从/blog//posts-2/的表达式

Here's an example of (many) 404s I'm getting: mysite.com/blog/post-name/ 这是我得到的(许多)404的示例: mysite.com/blog/post-name/

Also, I need to be able to use it in conjunction with the date/permalink solution, Source: 另外,我需要能够将其与日期/永久链接解决方案结合使用,来源:

/(\d*)/(\d*)/([A-Za-z0-9-]*) Target: /$4

Any input would be greatly appreciated. 任何投入将不胜感激。

try to add this to your .htaccess file: 尝试将其添加到您的.htaccess文件中:

RewriteEngine On
RewriteBase /
RewriteRule ^blog(/.*)?$ http://%{HTTP_HOST}/posts-2$1 [R=301,L]

(I don't get the last part of your question about date/permalink) (我没有得到您有关日期/固定链接问题的最后一部分)

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

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