.htaccess文件中的多个映射不起作用

时间:2011-03-04 21:43:13

标签: .htaccess url architecture

我在.htaccess文件中有这个映射

RewriteRule outdoors/trees/(.*)/(.*) outdoors/trees/tree.php?tree_id=$1
RewriteRule outdoors/parks/(.*)/(.*) outdoors/parks/park.php?tree_id=$1

由于某种原因,映射到树的工作,但公园的映射不起作用。 我想要做的是有一个这样的网址: http://www.comehike.com/outdoors/parks/park.php?park_id=1

重定向到如下所示: http://www.comehike.com/outdoors/parks/3/ParkName

知道为什么不能使用上面显示的重定向?

谢谢, 亚历

1 个答案:

答案 0 :(得分:1)

LAST标志可能有效。

RewriteRule outdoors/trees/(.*)/(.*) outdoors/trees/tree.php?tree_id=$1 [L]
RewriteRule outdoors/parks/(.*)/(.*) outdoors/parks/park.php?tree_id=$1 [L]

编辑: park_id

中的错字
RewriteRule outdoors/trees/(.*)/(.*) outdoors/trees/tree.php?tree_id=$1 [L]
RewriteRule outdoors/parks/(.*)/(.*) outdoors/parks/park.php?park_id=$1 [L]