使用.htaccess从网址中删除日期 [英] Removing date from url using .htaccess
本文介绍了使用.htaccess从网址中删除日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近更改了博客的永久链接格式,因此删除了日期:
I recently changed the permalink format of my blog so the date is removed:
http://site.com/blog/2011/01/post-name
现在是
http://site.com/blog/post-name
问题是带有日期的网址未重定向到新网址.我在.htaccess中尝试了一些正则表达式,但仍然得到404.有什么想法吗?
The problem is the url with date is not redirected to new url. I tried some regular expressions in .htaccess but still get 404. Any ideas?
推荐答案
解决方案是
RedirectMatch 301 /blog/([0-9]+)/([0-9]+)/(.*)$ /blog/$3
http://www.catswhocode.com/blog/WordPress的10个很棒的htaccess-hacks
这篇关于使用.htaccess从网址中删除日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文