开发者

mod_rewrite advice

I was wondering if you could advise if there is a more efficient way of writing what I have below? Could this be achieved in the 1 rule?

RewriteRule ^search/(cars|boats|plant)/([-a-zA-Z0-9]+)/type-([0-9]+)/price-([0-9]+)-([0-9]+)/?$ search.php?category=$1&location=$2&type=$3&minprice=$4&maxprice=$5 [L]
RewriteRule ^search/(cars|boats|plant)/([-a-zA-Z0-9]+)/type-([0-9]+)/?$ search.php?category开发者_运维知识库=$1&location=$2&type=$3 [L]
RewriteRule ^search/(cars|boats|plant)/([-a-zA-Z0-9]+)/?$ search.php?category=$1&location=$2 [L]
RewriteRule ^search/(cars|boats|plant)/?$ search.php?category=$1 [L]

Also, I am having difficulty obtaining a friendly URL after a form is submitted. How to do this?


Perhaps you'd be better off just writing one rule to redirect from /search to search.php, and then parsing the rest of the URI there? (I.e. redirect to search.php?q=REST_OF_URI_GOES_HERE)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜