0
我的服务器人无法解决我遇到的问题。我在根文件夹上运行Wordpress。我不想拥有英文的文件夹语言。Htaccess重定向规则问题
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/
同为URL:
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
非常感谢您的回答。我试过了,但它也将我重定向到www.domain.com。另外,我不想在主要语言的URL中使用语言标识... – JordanBelfort17
如果您正在重定向到www.domain.com,则必须在其他.htaccess或主httpd.conf中有其他位置,或者即使在PHP中。您提供的.htaccess在任何地方都没有“www”,因此无法重定向到其他域。 – BareNakedCoder
是的,了解主要语言不应该在URL中。这就是为什么该模式具有'?',这意味着匹配0或1的前一个。如果URL不是以fr,de,es或OR开头,那么$ 2将是“”,为空(暗示“en”)。 – BareNakedCoder