[英]add language parameter to link with htaccess
this is my htaccess 这是我的htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^login(.*)$ index.php?tab1=login [QSA,L]
this make this url 这就是这个网址
(localhost/example/login) (本地主机/示例/登录)
and in php $_GET['tab1'] its return login >> it works fine 并在php $ _GET ['tab1']中返回登录>>它工作正常
but I want to make this urls 但是我想制作这个网址
(localhost/example/login) (本地主机/示例/登录)
(localhost/example/en/login) (本地主机/示例/ EN /登录)
(localhost/example/fr/login) (本地主机/示例/ FR /登录)
with $_GET['lang'] to return the language in url 使用$ _GET ['lang']返回url中的语言
Try it like this, 试试这样,
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/([\w-]+)/([\w-]+)$ index.php?tab1=$3&lang=$2 [QSA,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.