Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

We have a website that has two URLs (one for the US side and another for the Canadian side which is then broken into Canadian English and Canadian French). For the purposes of my question, I will write as:

  • www.us_url.com (US)
  • www.canada_url.ca/ca_en/ (Canadian English)
  • www.canada_url.ca/ca_fr/ (Canadian French)

To make sure people are on the correct site, what do I do if they go to the US URL with Canadian English content (e.g. www.us_url.com/ca_en/canada.asp) but I want to make sure the URL is the Canadian one (e.g. www.canada_url.ca/ca_en/canada.asp) so it shows up properly in Google Analytics.

We're using IIS 7 and classic ASP.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Using the URL rewrite module, you should be able to do something like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Check US" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="www.us_url.com" />
                    <conditions>
                        <add input="{HTTP_URL}" pattern="/ca_en*" />
                    </conditions>
                    <action type="Redirect" url="http://www.canada_url.ca/ca_en/" />
                </rule>
                <rule name="Check US 2" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="www.us_url.com" />
                    <conditions>
                        <add input="{HTTP_URL}" pattern="/ca_fr*" />
                    </conditions>
                    <action type="Redirect" url="http://www.canada_url.ca/ca_fr/" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
share|improve this answer
    
Thanks very much! –  stephmoreland Jun 25 '12 at 16:38
    
You're welcome! –  Hoff Jun 25 '12 at 16:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.