How to rewrite urls in Advance Search
-
I am trying to change the dynamic urls to static. But don’t know how to optimize this url:
http://domain.com/advanced-search/?filter_search_action%5B%5D=sales&filter_search_type%5B%5D=apartments&advanced_city=jersey-city&advanced_area=bayonne&min-bedrooms=&available-from=&price_low=0&price_max=1500000&submit=SEARCH+PROPERTIESAs i want something like:
http://domain.com/sales/apartments/jersey-city/bayonne///0/1500000/SEARCH+PROPERTIES.htmlEven i have tried using function.php
function add_query_vars($new_var) {
$new_var[] = “?filter_search_action%5B%5D”;
$new_var[] = “filter_search_type%5B%5D”;
$new_var[] = “advanced_city”;
$new_var[] = “advanced_area”;
$new_var[] = “advanced_rooms”;
$new_var[] = “advanced_bath”;
$new_var[] = “price_low”;
$new_var[] = “price_max”;
$new_var[] = “submit”;return $new_var;
}
add_filter(‘query_vars’, ‘add_query_vars’);function add_rewrite_rules($rules) {
$new_rules = array(‘([^/]+)’ => ‘index.php/advanced-search/?filter_search_action%5B%5D=$matches[1]&filter_search_type%5B%5D=$matches[2]&advanced_city=$matches[3]&advanced_area=$matches[4]&advanced_rooms=$matches[5]&advanced_bath=$matches[6]&price_low=$matches[7]&price_max=$matches[8]&submit=$matches[9]’);
$rules = $new_rules + $rules;
return $rules;
}
add_filter(‘rewrite_rules_array’, ‘add_rewrite_rules’);
flush_rewrite_rules();Unfortunately its not working. Need your help friends…Thanks in Advance
-
-
- The topic ‘How to rewrite urls in Advance Search’ is closed to new replies.