I'm trying to clean up urls from extensions and php get language variables:
test.com/en/ => test.com/?lang=en
test.com/ro/page/ => test.com/page.php?lang=ro
Here is my .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 it transforms test.com/ro/page => test.com/page.php?lang=ro And test.com/ro/index => test.com/index.php?lang=ro
I cannot get it to transform index page test.com/en/ => test.com/?lang=en
Can you guys please help me to achieve this?