重写包含点的URL

时间:2019-05-08 15:30:57

标签: .htaccess url-rewriting

我正在寻找有关URL重写的帮助。

将要设置的方式是将http://example.com/forums/topic/name.1重写为http://example.com/forums/topic/index.php?topic=name.1,因此用值重写。在其他情况下,例如http://example.com/forums/topic/name将重写为http://example.com/forums/topic/index.php?topic=name,而http://example.com/forums/topic/1则将重写为http://example.com/forums/topic/index.php?topic=1

我使用的规则是RewriteRule ^resources/pages/forums/topic/([0-9]+)/?$ resources/pages/forums/topic/index.php?topic_id=$1 [NC,L](用于数字),但是我不确定表达式是否能够像尝试使用{{1}时那样通过字符,点和数字}表达式,无论出于何种原因,它都会重写index.php而不是name.1。 任何指针都可以帮上很多忙,我猜这仅仅是由于我使用的表达式。

0 个答案:

没有答案