How To Create Full Site Redirects Using The Plugin
-
Hello,
I am trying to create site-wide redirects for two separate locations. I want to contain our UK users, if they enter .com it will redirect them to the .co.uk and vice versa if any users outside of the UK try to enter .co.uk they will be directed to .com.
I found this code:
<?php
/**
* Redirect users according to location
*/function country_geo_redirect() {
$country = getenv(‘HTTP_GEOIP_COUNTRY_CODE’);
if ( $country == “GB” ) {
wp_redirect( ‘https://www.ggpoker.co.uk’;, 301 );
exit;
} else {
wp_redirect( ‘https://www.ggpoker.com’;, 301 );
exit;
}
}
add_action(‘init’, country_geo_redirect’);And where is this function to be placed and how do we call the this function so it is SITEWIDE?
Any help/assistance is greatly appreciated.
Regards,
Roudy
- The topic ‘How To Create Full Site Redirects Using The Plugin’ is closed to new replies.