Reputation: 83
I have recently decided to choose the subdomains option to redirect users to their preferred language.
for example if I have a french user hitting my website, the user will be automatically redirected to fr.example.com
The original language is English(US), and I have only a landing page to be translated in other languages (Not All website).
The landing page is index.php for example.
Do I have to duplicate the css files and the index.php in subdomains too ?
or
Is there any other options ?
Upvotes: 1
Views: 559
Reputation: 2065
Unless I am mistaken, I guess you want to redirect users to their preferred language using PHP framework, but i would advise you to use .htaccess
file to do this.
RewriteEngine On
RewriteCond %{HTTP:Accept-Language} (fr) [NC]
RewriteRule .* http://fr.example.com/ [R,L]
Note: you have to change example.com to your own domain name. I used the fr
language as an example.
Upvotes: 1