【发布时间】:2015-03-05 13:59:44
【问题描述】:
我非常感谢使用 Apache .htaccess 进行以下 301 重定向的帮助,因为我一直不知道如何执行此操作:
我需要转换: http://blog.domain.com/2015/03/filename.html
到: http://www.domain.com/blog/filename/
原始文件结构有很多事情要做。构成原始 URL 的年份和月份,每个月和几年都会更改并返回。即 2015/03、2015/02、2015/01、2014/12 等...
结尾 filename.html 需要是新目录名称的名称,不带结尾 .html 并添加结束 '/'
这是我目前所拥有的,但它不起作用:
RewriteRule http://blog.domain.com/([0-9]+)/([0-9]+)/(.*)\.html$ http://www.domain.com/blog/$3 [R=301,L]
【问题讨论】: