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

Reply To: Is this plugin compatible with a reverse proxy setup?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Is this plugin compatible with a reverse proxy setup? Reply To: Is this plugin compatible with a reverse proxy setup?

#39319
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

I believer the simplest solution to this is using a small custom code snippet to change the resutl URLs from the “cms.” subdomain to the main.

Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

add_filter( 'asp_results', 'asp_custom_link_results', 10, 4 );
add_filter( 'asp_noajax_results', 'asp_custom_link_results', 10, 4 );
function asp_custom_link_results( $results, $search_id, $is_ajax, $args  ) {
	// Array of original -> replacement links
	$replace = array(
		'cms.netpayadvance' => 'netpayadvance',
	);

	// --- DO NOT CHANGE ANYTHING BELOW ---
	foreach ($results as $k=>&$r) {
		$link = isset($r->link) ? $r->link : (isset($r->asp_guid) ? $r->asp_guid : '');
		if ( $link == '' )
		    continue;
		$link = str_replace(array_keys($replace), array_values($replace), $link);

		// Ajax results link
		if ( isset($r->link) ) {
            $r->link = $link;
        }
		// Results page link
		if ( isset($r->asp_guid) ) {
            $r->asp_guid = $link;
        }
	}

  return $results;
}