Im struggling for the last 2 days without any concrete results. I have setup a multi lingual website (dutch (default), english and german) with php. choosing a language is done by setting a $_GET var like ?lang=en.
But for pretty url's I decided to create 3 'fake' folders for the corresponding languages.
My website structure (htaccess in localhost/mywebsite/public):
localhost/mywebsite/public/index.php (and like index.php, also a few other pages like products.php etc.)
In the moment I can call the website by localhost/mywebsite/public/nl and with:
- Code: Select all
RewriteBase /mywebsite/public
RewriteRule ^(nl|en|de|NL|EN|DE)/(.*) $2?lang=$1 [NC,L,QSA]
RewriteRule ^(nl|en|de|NL|EN|DE)$ http://localhost/mywebsite/public/$1/index.php [R=301,L]
It is rewrited to localhost/mywebsite/public/index.php?lang=nl
Ok this works. but now comes my headache. I want the public folder removed from the url + I need one language as default so I would like to call the website from:
localhost/mywebsite and then it needs to redirect directly to localhost/mywebsite/nl. I tried it with putting the htaccess in the webiste root ( localhost/mywebsite) but then the above RewriteRules dont work anymore..
any suggestions?
Thanks n advance