我想要的是subcategory/1/date,所以它通过subcate_id->1排序->date。不过,我只能用PHP获得第一个。
RewriteRule ^subcategory/([0-9]+) subcategory.php?subcat_id=$1
RewriteRule ^subcategory/([0-9]+)(/([a-zA-Z0-9_-]+)) subcategory.php?subcat_id=$1&sort=$2
知道我的代码哪里出错了吗?
尝试反转顺序,这样如果存在更多参数,它将首先被捕获
RewriteRule ^subcategory/([0-9]+)/([a-zA-Z0-9_-]+)$ subcategory.php?subcat_id=$1&sort=$2
RewriteRule ^subcategory/([0-9]+)$ subcategory.php?subcat_id=$1
该死,它在我前面!!
好的,我通过切换规则并在外面加上"/"来解决我的问题。感谢ctrahey,还增加了$。
RewriteRule ^subcategory/([0-9]+)/([a-zA-Z0-9_-]+)$ subcategory.php?subcat_id=$1&sort=$2
RewriteRule ^subcategory/([0-9]+)$ subcategory.php?subcat_id=$1
谢谢你的帮助!