GET参数htaccess的语言重定向



我有这个代码,它会重新调用www.example.com吗?index.php?q=home&lang=en进入www.example.com/home。我想将其重定向到www.example.com/en/home。有可能吗?

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.php?q=$1&lang=$2 [L,QSA]
RewriteRule ^([^/]*)(.*)$ $1[L,QSA]

提前感谢

尝试:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]{2})/(.*)$ /index.php?q=$2&lang=$1 [L,QSA]

最新更新