views:

46

answers:

0

I want to re-write url using .htaccess I am new to it have created a site which is multi language.

I want my url and all directories or files under it to have a lang=en variable in it while url looks like.

site.com/en/

should be presenting http://site.com/?lang=en

or site.com/en/test1/?test=1

should be like: site.com/test1/?test=1&lang=en

I already removed index.php or php extention from site

Options +FollowSymLinks
Options -Indexes

RewriteEngine On 

RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]

# Redirect to remove /index.php files. 
RewriteCond %{THE_REQUEST} \ /(.+/)?index\.php(\?.*)?\  [NC] 
RewriteRule ^(.+/)?index\.php$ /%1 [NC,R=301,L] 

# Redirect to remove .php 
RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
RewriteCond %{SCRIPT_FILENAME} -f 
RewriteCond %{REQUEST_URI} ^(/.+)\.php$ 
RewriteRule ^(.+)\.php$ %1 [R=301,L]

# Rewrite to add .php back. 
RewriteCond %{REQUEST_URI} ^(/.+)$ 
RewriteCond %{SCRIPT_FILENAME}.php -f 
RewriteRule ^(.*[^/])$ %1.php [QSA,L]

How can I add the language variable to site?

Thank You,