Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Different domains for different languages


mazza

Recommended Posts

I got this idea as I run my shops at shared server and the provider offers Domain alias (not sure if a correct term for it) where there can be several totally transparent domains, maybe one for each language. All files would be in the same directory and oscommerce would know just one domain.

 

First in catalog/includes/configure.php make this modification:

 

 define('HTTP_SERVER', '');

 

In other words, do not give address here. This makes all the links relative.

 

then in all files directly under catalog directory, change:

 

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

 

To:

 

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER_LANG) . DIR_WS_CATALOG; ?>">

 

Then in language files insert:

 

// URL for this language

define('HTTP_SERVER_LANG', 'http://www.nameofyoursiteforthislanguage.com/');

 

That is about it. Remember this is only for those who can get the domain alias. Please let me know if you see anything wrong with this logic or code as it will be used on a live site on a near future.

"Use no way as way, have no limitation as limitation." - Bruce Lee

Link to comment
Share on other sites

Would this be a problem all the time or just when changing languages ? I have autologin installed and automatic browser detection working, so this would not be a major problem. I also plan to make some sort of .htaccess (like www.englishsite.com redirect to www.englishsite.com/catalog/default.php/language/en) trick or code change where language would be set according to sitename used.

 

The reason why I suggested entire domain change instead of sub-domains was the reason that the shop does not use www.nameofshop.com but www.whatwedo.com. This has been working great for search engines and national customers but would be a major hassle when going international.

"Use no way as way, have no limitation as limitation." - Bruce Lee

Link to comment
Share on other sites

  • 2 weeks later...

Matti,

 

Did you ever implement this in a "live shop" ? Does it work OK, any known problems - or did it break ?

 

I'm thinking of doing something fairly similar on the next shop, so would appreciate any advice you can give...

 

kiitos !

Link to comment
Share on other sites

Burt, I am sorry, but I have not had the opportunity to test this on a live shop.

 

The point where I got to was that every language had their own base href (that worked) , but there HTTP_SERVER is also used on the html_output.php. If you can implement the switch here, it should work.

 

You also migth want to check other places where HTTP_SERVER is used.

 

I eventually used a htaccess trick that redirects addressess this way:

 

www.english.com >> www.ourshop/catalog/default.php/language/EN

www.swedish.com >> www.ourshop/catalog/default.php/language/SE

www.ourshop.com >> www.ourshop/catalog/default.php/language/FI

 

And a small logo hack so different languages have different logos and link from logo.

"Use no way as way, have no limitation as limitation." - Bruce Lee

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...