添加语言参数以与 HTaccess链接



这是我的htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^login(.*)$ index.php?tab1=login [QSA,L]

这使得这个网址

(本地主机/示例/登录(

在 php $_GET['tab1'] 中,它的返回登录>>它工作正常

但我想制作这个网址

(本地主机/示例/登录(

(localhost/example/en/login(

(本地主机/示例/法语/登录(

使用 $_GET['lang'] 返回 URL 中的语言

试试这样,

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([w-]+)/([w-]+)/([w-]+)$ index.php?tab1=$3&lang=$2 [QSA,L]

最新更新