我的服务器上有以下.htaccess文件,并且在多语言部分中,该网站在除根目录之外的所有页面上都能正常运行。
获取:ROOT_DOMAIN //?lang = zh-CN
期望:ROOT_DOMAIN / zh /
我该如何实现?
RewriteEngine On
RewriteBase /
## hide .php extension snippet
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1/ [R,L]
# add a trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteRule . %{REQUEST_URI}/ [L,R=301]
# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]
RewriteRule ^(payments)($|/) - [L]
RewriteRule ^(fr|pt|es|it|de|ru)/(.*?)/?$ $2.php?lang=$1 [QSA,L]