php - To handle - character in parameter value -
my url :
http://www.abc.com/search_result.php?parrent_prop_type=value1&prop_type_name=-value2&location=value-3&prop_type_auto_id=value4
want change
http://www.abc.com/value1-value2-value-3-value4
my rule :
rewritecond %{the_request} ^[a-z]{3,}\s/+search_result\.php\?parrent_prop_type=([-0-9a-za-z]+)\&prop_type_name=([-0-9a-za-z]+)\&location=([-0-9a-za-z]+)\&prop_type_auto_id=([-0-9a-za-z]+) [nc] rewriterule ^ http://abc.com/%1-%2-%3-%4? [r=301] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([-0-9a-za-z]+)-([-0-9a-za-z]+)-([-0-9a-za-z]+)-([-0-9a-za-z]+)/?$ search_result.php?parrent_prop_type=$1&prop_type_name=$2&location=$3&prop_type_auto_id=$4 [nc]
rewrite working properly, problem on search_result.php. search_result.php not working properly. can't proper value of parameter on search page. due - character in parameter.because when remove - character values works properly.
what should ?
thanks !
you can't use hyphen delimiter , expect able match within delimited values well.
take following example:
bo-b-fred-jam-es-arth-ur
it won't know ones separator hyphens , ones count actual values.
choose different delimiter, or don't match values hyphen in them.
perhaps using underscore delimiter more sensible, if have match hyphens within values:
bo-b_fred_jam-es_arth-ur
then match:
rewriterule ^([\-0-9a-za-z]+)_([\-0-9a-za-z]+)_([\-0-9a-za-z]+)_([\-0-9a-za-z]+)/?$ search_result.php?parrent_prop_type=$1&prop_type_name=$2&location=$3&prop_type_auto_id=$4 [nc]
Comments
Post a Comment