我如何:如何做URL掩码?
http://ecorustic.com/model.php?category=Destinations&name=destindere&id=138
显示为:
http://ecorustic.com/Destinations/destindere
给用户,但在页面仍指向:
http://ecorustic.com/model.php?category=Destinations&name=destindere&id=138
? 我试着下面的代码,但链接保持不变:
RewriteEngine On
RewriteRule ^[A-Za-z-]+/[A-Za-z-]+/[A-Za-z-]+/([A-Za-z0-9-]+)/?$ model.php?category=$1&name=$2&id=$3
通过什么魔法我们应该推断ID? – TRiG 2013-02-11 12:04:22
138可以从数据库中的“destindere”派生吗?如果是这样,那么可以这样做 - 第一步是删除model.php URL中的“id”查询字符串要求,并在内部执行查找。 – halfer 2013-02-11 12:05:15
页面解析时给出id,它是数据库中页面的ID – Johny 2013-02-11 12:06:20