【发布时间】:2015-02-18 06:57:36
【问题描述】:
我以前用这种方式重写了文章的 URL:
RewriteRule ^([^/\.]+)/([^/\.]+)/?article_(.*)_(.*).html$ index.php?sectionpp=$1§ionpp2=$2&content=article&artid=$3&curbigart=$4 [L]
这产生了如下网址: http://www.domain.com/Entertainment/114194/VINYETTE-TO-RELEASE-DEBUT-ALBUM-ON-MAY-7-2013
但是,现在我重新设计了网站并缩短了网址:
RewriteRule ^([^/\.]+)/([^/\.]+)$ index.php?sectionpp=$1&content=article&artid=$2&curbigart=$3 [L]
产生如下网址: http://www.domain.com/Entertainment/114194
问题: 是否可以重定向已经重写的url http://domain.com/Entertainment/114194/VINYETTE-TO-RELEASE-DEBUT-ALBUM-ON-MAY-7-2013
到
http://domain.com/Entertainment/114194
显然我们不是在谈论单页,而是数千页,所以需要 .htaccess 中的一行好,呵呵。我知道我可以简单地在 php 中重定向,但我认为在 .htaccess 中也必须有办法做到这一点?
谢谢!
【问题讨论】:
标签: regex apache .htaccess mod-rewrite redirect