.htaccess - htaccess: php language variable on index page -
i'm trying clean urls extensions , php language variables:
test.com/en/ => test.com/?lang=en
test.com/ro/page/ => test.com/page.php?lang=ro
here .htaccess:
adddefaultcharset utf-8 options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule .* - [l] rewriterule ^([^/]+)/([^.]+)\.php /$2.php?lang=$1 [l,nc,qsa] rewritecond %{request_filename} !-f rewriterule ^([^/]+)/$ $1.php rewriterule ^([^/]+)/([^/]+)/$ /$1/$2.php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !(\.[a-za-z0-9]{1,5}|/)$ rewriterule (.*)$ /$1/ [r=301,l]
while transforms test.com/ro/page => test.com/page.php?lang=ro , test.com/ro/index => test.com/index.php?lang=ro
i cannot transform index page test.com/en/ => test.com/?lang=en
can guys please me achieve this?
right under rule:
rewriterule ^([^/]+)/([^.]+)\.php /$2.php?lang=$1 [l,nc,qsa]
try adding rule:
rewriterule ^([^/]{2})/?$ /?lang=$1 [l,nc,qsa]
Comments
Post a Comment