.htaccess add hidden php get variable for language selection

Posted by Eric Di Bari on Stack Overflow See other posts from Stack Overflow or by Eric Di Bari
Published on 2010-04-06T19:13:12Z Indexed on 2010/04/06 22:13 UTC
Read the original article Hit count: 377

Filed under:
|
|
|

I have a multiple language website, and I use a php get variable to set the cookie for the language setting. I have multiple subfolders (http://www.site.com/es and http://www.site.com/de) that each have a respective .htaccess file. When accessing these folders, the .htaccess file does this to "silently" redirect the user and add the appropriate php variable:

-------
Options +FollowSymlinks
RewriteEngine on
RewriteOptions MaxRedirects=10
rewriterule ^http://www.site.com/es/$ http://www.site.com/?l=es [P,R=301]
rewriterule ^(.*)$ http://www.site.com/$1?l=es [P,R=301]
-------

When someone accesses the root directory: http://www.site.com, I want to add a ?l=en suffix "silently" to the url. How do I do that? Thanks.

© Stack Overflow or respective owner

Related posts about htaccess

Related posts about php