Hello, I have a website that should be available in several languages. I did this using Wordpress. I am trying to ensure that each language gets its own (virtual) subdomain. So, for example, fr.foo.eu and nl.foo.eu.
I currently have URLs in the following format: foo.eu/?lang=nl foo.eu/?lang=fr
There may be more content in the url:
http://hypnose.eu/hallo-wereld/?lang=nl
And I would like to have my urls like this using htaccess:
http://nl.hypnose.eu/hallo-wereld/
Could you guys help me with this?
Here is what I still have in my .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^([a-z]{2}\.hypnose\.eu$ [NC]
RewriteCond %{THE_REQUEST} \ /+([^\?]*)\?lang=([a-z]{2})&?([^\ ]*)
RewriteRule ^ http://%2.hypnose.eu/%1?%3 [L,R]
RewriteCond %{QUERY_STRING} !(^|&)lang=
RewriteCond %{HTTP_HOST} ^([a-z]{2})\.hypnose\.eu$ [NC]
RewriteRule ^(.*)$ /$1?lang=%2 [L,QSA]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
source
share