Htaccess cookie重写没有重定向

时间:2018-06-06 18:36:23

标签: .htaccess cookies url-rewriting multilingual

我正在处理多语言CMS,而且我遇到了htaccess代码。 我尝试使用lang HTTP_COOKIE重写URL,无论请求的URL是什么:

http://localhost/site/en/Admin/login.php(而不是http://localhost/site/Admin/login.php

OR

http://localhost/site/en/Admin/default.php(而不是http://localhost/site/Admin/default.php

但我希望不要被重定向到不存在的/ en /文件。

的.htaccess

RewriteCond %{HTTP_COOKIE} lang=([^;]+) [NC]

RewriteRule ^(.*)$ http://localhost/site/%1/$1 [L]

0 个答案:

没有答案