Search code examples
.htaccesslang

same .htacces - multiple parked domains - same root folder - redirect to language link


I have multiple domains.

domain.com
domain.dk
domain.ro ... etc

All are pointed to the same root folder via Parked Domains. So .htaccess file is the same for all.

Also is have a php language script and a php currency script witch help users changing the language via session variables. The link looks like this: index.php?lang=en&currency=USD (this are default session variables 'en' AND 'USD' ).

How can i setup .htaccess so when somebody click on www.domain.dk to redirect to ?

www.domain.dk/index.php?lang=da&currency=DKK

How can i setup .htaccess so when somebody click on www.domain.ro to redirect to ?

www.domain.ro/index.php?lang=ro&currency=RON

etc ...

Thank you. Florin


Solution

  • RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} \.dk$
    RewriteRule ^$ /index.php?lang=da&currency=DKK [QSA]
    
    #repeat for .ro