This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Use custom URL for default search results page

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Use custom URL for default search results page Reply To: Use custom URL for default search results page

#40382
thebizpixiethebizpixie
Participant

OK, so I’ve tested the var_dump and there is a difference.

Without redirect
URL is /?s=frog&asp_active=1&p_asid=1&p_asp_data=1&filters_initial=1&filters_changed=0&qtranslate_lang=0&current_page_id=36192

array(8) { 
["s"]=> string(6) "frog" 
["asp_active"]=> string(1) "1" 
["p_asid"]=> string(1) "1" 
["p_asp_data"]=> string(1) "1" 
["filters_initial"]=> string(1) "1" 
["filters_changed"]=> string(1) "0" 
["qtranslate_lang"]=> string(1) "0" 
["current_page_id"]=> string(5) "36192" } NULL

With redirect
URL is /search/frog/?asp_active=1&p_asid=1&p_asp_data=1&filters_initial=1&filters_changed=0&qtranslate_lang=0&current_page_id=36192

array(7) {
["asp_active"]=> string(1) "1" 
["p_asid"]=> string(1) "1" 
["p_asp_data"]=> string(1) "1" 
["filters_initial"]=> string(1) "1" 
["filters_changed"]=> string(1) "0" 
["qtranslate_lang"]=> string(1) "0" 
["current_page_id"]=> string(5) "36192" } NULL

So there only difference is that the “s” parameter is missing from the _GET array with the redirect, but then that makes sense because we’re redirecting the URL.

As a test, I added the ‘s parameter back to my URL, so now the redirection rule reads:

RewriteCond %{QUERY_STRING} \\?s=([^&]+)\&(.*) [NC]
RewriteRule ^$ /search/%1/?s=%1&%2 [NC,L,R]

and the URL now contains the search term twice:

/search/frog/?s=frog&asp_active=1&p_asid=1&p_asp_data=1&filters_initial=1&filters_changed=0&qtranslate_lang=0&current_page_id=36192

and voila, it now overrides the results correctly, so that part of the problem is now resolved.

Unfortunately, if I filter down my results using the settings, the URL still reverts to the original URL ie. /?s=frog and loses the redirected version of the URL.

Note: Setting the Custom redirect URL to “/search/{phrase}/” does not seem to have any effect.

Any ideas why this is happening and what I can do about it?

Thanks for your patience and persistence with this.