.htaccess htaccess重写404错误
我有一个旧的wordpress博客,我需要将所有帖子重定向到一个新系统,但url略有不同,帖子的日期被删除。例如,旧url如下所示:.htaccess htaccess重写404错误,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我有一个旧的wordpress博客,我需要将所有帖子重定向到一个新系统,但url略有不同,帖子的日期被删除。例如,旧url如下所示: http://www.myolddomain.com/2012/11/30/the-title-of-my-post/ http://www.mynewdomain.com/blog/2012/11/the-title-of-my-post 但新的url如下所示: http://www.myolddomain.com/2012/11/30/the-title-
http://www.myolddomain.com/2012/11/30/the-title-of-my-post/
http://www.mynewdomain.com/blog/2012/11/the-title-of-my-post
但新的url如下所示:
http://www.myolddomain.com/2012/11/30/the-title-of-my-post/
http://www.mynewdomain.com/blog/2012/11/the-title-of-my-post
我花了很长时间才把它重写好。我一直收到这样一条消息:在旧服务器上找不到url(404)。所以它不是重定向。以下是我当前的htaccess条目:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^/([0-9]+)$/([0-9]+)$/([0-9]+)$/([0-9]+)$ http://www.mynewdomain.com/blog/$1/$2/$4[R=301,L]
非常感谢您的建议。请尝试:
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/([a-z0-9\-]+)/$ http://www.mynewdomain.com/blog/$1/$2/$4 [R=301,L]
$
符号(即end
)应仅附加在末尾(如有必要!)
经过测试,效果良好。谢谢!成功了!我知道一定是一些我看不见的简单的东西。