clean urls with mod_rewrite from a GET form
I have a search form with 2 fields (category and keywords). Depending on the user input urls looking something like:
search.php?cat=&search=&agree=agree_terms&go=Go
I have some re_write rules for other pages which are fine but I'm stuck on how to deal with this search form
I came across a solution that suggested combining mod_rewrite with a php meta refresh from an additional page. I managed to get this to work but 开发者_开发问答it occurred to me that this may not be a search engine friendly solution.
Is there a way I can have clean urls from a GET form with mod_rewrite rules only?
If you have a fixed number of arguments, you can try something like:
RewriteRule ^query/arg_1/([^/]*)/arg_n/([^/]*)/$ search.php?arg_1=\1&arg_n=\2
(and so on)
This will transform /query/arg_1/value_1/arg_n/value_n/
into /search.php?arg_1=value_1&arg_n=value_n
, but you have to make sure values are properly escaped.
The practical motivation to link a "get" URL like this instead of using default parameters or hidden fields is beyond me.
精彩评论