I know there are many topics. I tried them many times, but it doesn\'t work.
Instead of example.com/en/file.php
, users see only
Perhaps something like this. Modify as you see fit for more specific pattern matching.
RewriteRule ^(?:(.*)/)?(.*)$ $2.php?lang=$1
Rewrites:
/en/fun => /fun.php?lang=en
/ru/fun => /fun.php?lang=ru
/fun => /fun.php?lang=
DirectoryIndex index.php index.html
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ $1.php [L,QSA]
In your links, don't use extensions.
Fixed by adding one line:
RewriteEngine on
**Options -Multiviews**
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ $1.php [L,QSA]