如何在SEO网址中传递动态查询字符串
问题描述:
I'm using this query string URL for detail page "detail.php?id=860&c=house&t=engineer". It will redirect to "detail/860/house/engineer" using rewrite rule.
sometimes I have to pass an extra parameter in detail page but rewrite doesn't accept those query strings.
This is rewrite rule in htaccess
RewriteRule ^detail/([^/]+)/([^/]+)/([^/]+)$ detail.php?id=$1&c=$2&t=$3 [L,NC]
if I'd add the fourth param is 'rb' I can add here easily but the fourth param will be 'rb' or 'rul' or whatever may be.
how to do this?
答
You have to use it something like this if you want to use 5th parameter, detail/860/house/engineer/<dynamic param>/<your value>
RewriteRule ^detail/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ detail.php?id=$1&c=$2&t=$3&$4=$5 [L,NC]