[英]Htaccess redirects rules issue
我的服务器人员无法解决我遇到的问题。 我在根文件夹上运行Wordpress。 我不想使用英语的文件夹语言。
https://domain.com/account/t/
https://domain.com/fr/account/t/
工作正常,对于:
https://domain.com/auth/
但
https://domain.com/fr/account/t/myaccount/
工作正常,但不是
https://domain.com/account/t/myaccount/
网址相同:
https://domain.com/fr/account/t/tests/
工作正常,但不是
https://domain.com/account/t/test/
它将重定向到www.domain.com ...
会有一个主意吗? 这是我的htaccess文件:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*)/auth/$ /auth/?lang=$1 [L]
RewriteRule ^([^/]*)/auth/login$ /auth/login.php?lang=$1 [L]
RewriteRule ^([^/]*)/auth/logout$ /auth/logout.php?lang=$1 [L]
RewriteRule ^([^/]*)/auth/registration$ /auth/registration_form.php?lang=$1 [L]
RewriteRule ^([^/]*)/auth/password-forgotten$ /auth/forgot_form.php?lang=$1 [L]
RewriteRule ^([^/]*)/auth/reset$ /auth/reset.php?lang=$1 [L]
RewriteRule ^([^/]*)/auth/activate$ /auth/activate.php?lang=$1 [L]
RewriteRule ^([^/]*)/account/$ /account/?lang=$1 [L]
RewriteRule ^([^/]*)/account/t/$ /account/t/?lang=$1 [L]
RewriteRule ^([^/]*)/account/t/jobs/$ /account/t/jobs.php?lang=$1 [L]
RewriteRule ^([^/]*)/account/t/myaccount/$ /account/t/myaccount.php?lang=$1 [L]
RewriteRule ^([^/]*)/account/t/([^/]*)$ /account/t/?lang=$1&step=$2 [L]
RewriteRule ^([^/]*)/account/t/tests/$ /account/t/testspage.php?lang=$1 [L]
RewriteRule ^([^/]*)/account/c/$ /account/c/?lang=$1 [L]
RewriteRule ^([^/]*)/account/c/([^/]*)$ /account/c/?lang=$1&step=$2 [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
在您的代码中,即使不是语言标识符, [^/]*
也会全部匹配。 有时,您会匹配一些需要作为脚本名称一部分的内容。
如果您使用此...
RewriteRule ^((fr|de|es|it)/)?(.*) /$3.php?lang=$2
您仅匹配列出的支持的一种语言。 同样,这种通用方法意味着您只需要1个重写器,而不需要每个PHP脚本1个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.