Using a ProxySG to redirect users to www.google.com/ncr ('no country redirect')

book

Article ID: 167111

calendar_today

Updated On:

Products

ProxySG Software - SGOS

Issue/Introduction

The Google home page has numerous regional domain equivalents, such as www.google.co.jp, www.google.fr, or www.google.ca to mention just a few, and in most cases when a user browses to www.google.com they'll be redirected automatically to the appropriate regional domain for their country location, based on a lookup of their source IP.

To prevent this from happening, the ProxySG administrator can setup a redirect to Google's No Country Redirect URL in the VPM or local policy, which will force the loading of the main www.google.com homepage regardless of the source IP location detected by the Google server.

Resolution

To setup the policy in the VPM:

  1. Add a new Web Access Layer, and give it a suitable name such google_ncr
  2. Right-click the Destination, and add a new Combined Destination object, named for example google_regional
  3. In the Combined Destination Object editor window, create a new Request URL, and add it to the main 'At least one of these objects' section. Configure this URL object as a Regular Expression Match, and enter ^http://www.google.[a-z]{2.EN_US}[./] in the Regex: field.

 

  1. In the Combined Destination Object editor window, create another Combined Destination object, named for example google_com
  2. Create 2 Request URL objects to the second Combined Destination object, the first as a Regular Expression Match for ^http://www.google.com$ and the second as a Regular Expression Match for ^http://www.google.com/, and add them both to the main 'At least one of these objects' section of this second Combined object. Create a third Request URL object with advanced match. Enter host google.com the path /ncr


User-added image

  1. Now add the second Combined Destination Object to the 'AND At least one of these objects' section of the first Combined Destination object, and tick the 'negate' box below that section.

 

  1. In the Action column a new Return Redirect, named for example google_ncr, and enter http://www.google.com/ncr in the URL field

User-added image

 

  1. Install the policy

 

To setup the policy in the local policy file:

  1. Open the local policy file using either the built-in or an external editor, and paste in the following CPL at the top or bottom:

define condition google_com
url.regex="^http://www.google.com$"
url.regex="^http://www.google.com/"
url.path="/ncr"
end

define condition google_regional
url.regex="http://www.google.com.[a-z]{2.EN_US}[./]"
end

define condition google_ncr
condition=google_regional condition=!google_com
end

define action ReturnRedirect1
redirect(302, "(.*)", "https://www.google.com/ncr" );
end

<Proxy>
condition=google_ncr action.ReturnRedirect1(yes)

  1. Install the Policy

 

Attachments