Reputation: 2246
Have site with many languages extra languages are in subdomains on my server like de.mydomain.com, fr.mydomain.com. in these de,fr subdirectory i've placed only htaccess file with this code:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.de\.mydomain\.com$
RewriteRule ^(.*)$ "http://www.mydomain.com/$1?lan=2%1" [L]
And it works but not how I want. it simply redirects from de.mydomain.com to mydomain.com, url in the browser is changing and I would like the url to stay like: de.mydomain.com but the content to be taken from mydomain.com?lan=2.(i use lan variable to change lang)
what do I do wrong here? maybe my general aproach to this problem is wrong?
Upvotes: 1
Views: 410
Reputation: 7739
Edit :
You need to point de subdomain to the root directory instead, and then adding these lines to the root htaccess file :
RewriteCond %{HTTP_HOST} ^(www\.)?de\.mydomain\.com$
RewriteRule ^(.*)$ /$1?lan=2 [L,QSA]
Upvotes: 1
Reputation: 268
Put this rule before your rule:
RewriteRule !^(fr|en)/ /en%{REQUEST_URI} [L,R=301]
.htaccess rewrite to default language folder?
Upvotes: 0