Hi Radek,
Thanks for the code. It works for me in New Zealand.
But when I try for US, it doesn't work.
My Website URL is www.kudosweb.com.
If US customers come to this URL it should redirect to www.kudosweb.com/US
This is the code I have written in app_code/global.asax.cs:
private static void RewriteUrl(string relativePath, ExcludedSystemEnum excludedEnum, ViewModeOnDemand viewMode, SiteNameOnDemand siteName)
{
string siteName12 = CMSContext.CurrentSiteName;
if (siteName12 == "kudosweb")
{
string ip = HttpContext.Current.Request.UserHostAddress;
string currentCountryName = IP2CountryHelper.GetCountryByIp(ip);
string currentDomain = CMS.GlobalHelper.UrlHelper.GetCurrentDomain().ToLower();
switch (currentCountryName)
{
case "UNITED STATES":
if (currentDomain == "kudosweb.com")
{
URLRewriter.Redirect("http://www.kudosweb.com/US/");
}
if(currentDomain == "www.kudosweb.com")
{
URLRewriter.Redirect("http://www.kudosweb.com/US/");
}
break;
}
}
else
{
}
bool checkParameters = true;
Could you please see , if there's anything wrong in the code.
Thanks
Gitesh Shah