[ic] Setting the locale while coming from another domain

Ton Verhagen tverhagen at alamerce.nl
Thu Jun 28 05:27:21 EDT 2007

Quoting Racke:
>Ton Verhagen wrote:
>>Dear All,
>>I am using a .com domain (e.g. www.mydomain.com) with default 
>>locale set to en_US.
>>The catalog running on this domain can be accessed by: 
>>www.mydomain.com/cgi-bin/shop .
>>The DirectoryIndex for this domain has been set to: /cgi-bin/shop/index.html
>>Now I would like to access this catalog from different domains 
>>while setting the
>>locale for those domains at first entry.
>>www.mydomain.de ----> 
>>www.mydomain.fr ----> 
>>Thus accessing e.g. www.mydomain.de should set the de_DE locale on 
>>the main domain.
>>I tried the following in Apache's virtual host section for the 
>>'.de' and '.fr' domains:
>>Redirect / 
>>         or
>>RewriteEngine On
>>RewriteRule ^/(.*) 
>>http://www.domain.com/cgi-bin/shop/process/locale/de_DE/page/index.html [p]
>>Both settings do redirect the user from e.g. www.mydomain.de to the 
>>main domain www.mydomain.com
>>however, the locale will not be set.
>>When I past the redirect URL in my browser, the locale will be set 
>>to the one provided in the URL.
>>Any ideas what I might be missing here?
>You could also do the locale initializations in Autoload, example
>from http://www.materialboerse.de/:
># check if we enter from an English or a German site
># and set locale accordingly
>unless ($Scratch->{locale_initialized}) {
>         $Scratch->{locale_initialized} = 1;
>         my $locale = 'de_DE';
>         my $vhost = $Tag->env('VIRTUAL_HOST') || $Tag->env('SERVER_NAME');
>         for (split (/\s/, $Variable->{ENGLISH_SITES})) {
>                 if ($_ eq $vhost) {
>                         # need English
>                         $locale = 'en_US';
>                         $Config->{VendURL} = 
> "http://${vhost}$Variable->{CGI_URL}";
>                         last;
>                 }
>         }
>         $Tag->setlocale({locale=>$locale,persist=>1});

Thanks, Racke !

I see that you mangle the VendURL as well. Wouldn't this result in
having Apache to redirect to the main domain for each page access?

Any other settings required for the catalog in order to make the above work?

Thanks again!

Best regards,


Alamerce Nederland --- Cornerstone of eBusiness
Phone +31-40-2374381    info at alamerce.nl    http://www.alamerce.nl

eCommerce Solutions -- Consulting -- Website & Interchange Hosting 

More information about the interchange-users mailing list