Originally Posted by
manishanirula
... I have added Advanced_search_result in the pages to have Seo urls. It works fine if we search for one word but if we search for 2 words the search page 1 works fine but on clicking page 2 we are taken to advanced search page. ...
Correct. There are a number of things at play here, but the root cause is a double encoding of the URLs on the "search pages".
The quickest fix is to just disable generating alternative URLs for "advanced_search_result".
Upon initial installation Ultimate URLs enabled generation of alternate URLs for "index, product_info, product_music_info, document_general_info, document_product_info, product_free_shipping_info, products_new, products_all, shopping_cart, featured_products, specials, contact_us, conditions, privacy, reviews, shippinginfo, faqs_all, site_map, gv_faq, discount_coupon, page, page_2, page_3, page_4". This is the recommended setting for most sites.
A slightly more complex fix (allowing generation of alternative URLs for the search result pages) involves making changes to "/includes/classes/usu.php".
Replace:
Code:
/**
* Convert an array of query parameters to a URI query string. This is safe
* for use under 5.2+ with optimizations for PHP 5.4+.
*
* @param array the array of query parameters
*/
protected function build_query($parameters) {
if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
$parameters = http_build_query($parameters, '', '&', PHP_QUERY_RFC3986);
}
else {
$compile = array();
foreach($parameters as $key => $value) {
if($key !== null && $key != '') {
// Prior to PHP 5.3, tildes might be encoded per RFC 1738
// This should not impact functionality for 99% of users.
$compile[] = rawurlencode($key) . '=' . rawurlencode($value);
}
}
$parameters = implode('&', $compile);
unset($compile);
}
return $parameters;
}
With:
Code:
/**
* Convert an array of query parameters to a URI query string. This requires
* the code calling zen_href_link() to ensure all parameters passed to the
* function to be already encoded when applicable.
*
* @param array the array of query parameters
*/
protected function build_query($parameters) {
$compile = array();
foreach($parameters as $key => $value) {
if($key !== null && $key != '') {
$compile[] = $key . '=' . $value;
}
}
return implode('&', $compile);
}
NOTE: Those with third party code assigning arrays (as the value) for a key in the URL parameters (not recommended) will need to apply additional changes to the function.
Bookmarks