- .htaccess rewrite for language subdomains
- <IfModule mod_rewrite.c>
- RewriteEngine On
- RewriteBase /
- RewriteRule ^es.domain.com/?$ ^domain.com/es_ES?$ [L,R=301]
- </IfModule>
- Options +FollowSymlinks
- RewriteEngine On
- RewriteBase /
- RewriteCond %{HTTP_HOST} ^es.
- RewriteCond %{REQUEST_URI} !^/es
- RewriteRule ^(.*)$ http://domain.com/es_ES/$1 [P,L]
- RewriteCond %{HTTP_HOST} ^es.mydomain.com$
- # Change the path:
- RewriteRule ^/?$ /public/www/index.php
- RewriteCond %{HTTP_HOST} ^(us|fr|pt).mydomain.com$
- # Create an environment variable to remember the language:
- RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
- # Now check if the LANGUAGE is empty (= doesn't) exists
- RewriteCond %{ENV:LANGUAGE} ^$
- # If so, create the default language (=es):
- RewriteRule (.*) - [QSA,E=LANGUAGE:es]
- RewriteCond %{ENV:LANGUAGE} ^es$
- # Change the root folder:
- RewriteRule ^/?$ /public/www/index.php
- RewriteCond %{HTTP_HOST} ^(us|fr|pt).mydomain.com$
- # Create an environment variable to remember the language:
- RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
- # Now check if the LANGUAGE is empty (= doesn't exist)
- RewriteCond %{ENV:LANGUAGE} ^$
- # If so, create the default language (=es):
- RewriteRule (.*) - [QSA,E=LANGUAGE:es]
- # Change the root folder of the spanish language:
- RewriteCond %{ENV:LANGUAGE} ^es$
- # Change the root folder:
- RewriteRule ^/?$ /public/www/index.php
- RewriteCond %{HTTP_HOST} ^(us|fr|pt).mydomain.com$
- # Create an environment variable to remember the language:
- RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
- # Now check if the LANGUAGE is empty (= doesn't exist)
- RewriteCond %{ENV:LANGUAGE} ^$
- # If so, create the default language (=es):
- RewriteRule (.*) - [QSA,E=LANGUAGE:es]
- # WHATEVER THE LANGUAGE ADD IT TO THE URI:
- RewriteRule (.*) $1?language=%{ENV:LANGUAGE} [QSA]
- <IfModule mod_rewrite.c>
- RewriteEngine On
- RewriteBase /
- RewriteCond %{HTTP_HOST} ^(us|fr|pt).mydomain.com$
- RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
- RewriteCond %{ENV:LANGUAGE} ^$
- RewriteRule (.*) - [QSA,E=LANGUAGE:es]
- RewriteRule (.*) $1?language=%{ENV:LANGUAGE} [QSA]
- </IfModule>
- RewriteCond %{HTTP_HOST} ^(us|fr|pt).mydomain.com$
- RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
- RewriteCond %{ENV:LANGUAGE} ^$
- RewriteRule (.*) - [QSA,E=LANGUAGE:es]
- RewriteCond %{ENV:LANGUAGE} ^es$
- RewriteRule ^/?$ /public/www/index.php