Hi, I'm developing a new website and I want to create multiple subdomains where the only difference will be the language. My doubt is: do I need to replicate all the files from the root directory to each of the subdomain directory or can I do the "conversion" using the mod_rewrite in .htaccess? I'm trying to use a rewrite rule to redirect the a file in the main directory, having the following in the .htaccess of the subdomain directory: RewriteRule ^page/*$ ./../page.php [L] If I use the rule, the address (browser) changes from subdomain.domain/page/ to domain/page.php RewriteRule ^page/*$ http://domain/page.php [L] Can anyone help me, please? Thank you in advance.
So you're wanting to have like en.domain.ext, fr.domain.ext etc, but keep most of your files in the main domain.ext directory, just having different language files in the subdomain directories? Why bother with rewriting url's at all? Just set the documentroot of each subdirectory to the documentroot of the domain, so that all will access the same file. Then use $the_subdomain = $_SERVER["SERVER_NAME"]; to see which subdomain was requsted, and include your language files accordingly?
I believe this is the right place to post your request, as I also believe is Nintendo who can help you with this when he comes around
Scolls, thank you very much. What a simple solution! Now, I have to see how can I change the httpd.conf file of my hosting service. On my machine is working 100%. Thank you very much, again.
Pleasure, JRJR. If you can't come right with your hosting service, there's also another simple solution: Use GET! eg index.php?lang=en for english, index.php?lang=fr for french, etc. Your default language naturally doesn't need a param since you'd default it to that language anyway if (!isset($_GET("lang"))). Include language files as before... You could possibly set up 301's for each subdomain, and then I'd imagine the referer field should show the subdomain? Not 100% sure offhand, but might also be worth a try. Then, proceed as before.
It seems that my host service can change the document root. Thank you very much....also for the other solution!