.htaccess expressionengine在搜索提交后从url中删除问号
我有一个多语言的网站,我的第二语言进入一个子目录.htaccess expressionengine在搜索提交后从url中删除问号,.htaccess,expressionengine,.htaccess,Expressionengine,我有一个多语言的网站,我的第二语言进入一个子目录mysite.com/en/。除了搜索功能,一切都很好。当我提交搜索时,它会在子目录后面打印一个问号,如下所示: mysite.com/en/?/noresult/6bc629a9319d90a1e9703eaf2c00f7cd/ 正因为如此,我的网站重定向到主页。我搜索并尝试了许多.htaccess代码,但都不起作用。没有问号的URL工作正常 这是我的.htaccess: <IfModule mod_rewrite.c>
mysite.com/en/
。除了搜索功能,一切都很好。当我提交搜索时,它会在子目录后面打印一个问号,如下所示:
mysite.com/en/?/noresult/6bc629a9319d90a1e9703eaf2c00f7cd/
正因为如此,我的网站重定向到主页。我搜索并尝试了许多.htaccess
代码,但都不起作用。没有问号的URL工作正常
这是我的.htaccess
:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /en/
# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)/index\.php/*(.*) /$1$2 [R=301,NE,L]
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ /en/index.php?/$1 [L]
RewriteRule ^(.*)$ /en/index.php?/$1 [L,QSA]
</IfModule>
重新启动发动机
重写BASE/en/
#从ExpressionEngine URL中删除index.php
RewriteCond%{THE_REQUEST}^GET.*index\.php[NC]
重写cond%{REQUEST_URI}/系统/*[NC]
重写规则(.*)/index\.php/*(.*)/$1$2[R=301,NE,L]
#通过站点索引文件指示所有EE web请求
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#重写规则^(.*)$/en/index.php?/$1[L]
重写规则^(.*)$/en/index.php?/$1[L,QSA]
有人能帮我吗?您需要关闭目录斜杠,然后使用重写规则添加尾部斜杠:
<IfModule mod_rewrite.c>
DirectorySlash Off
RewriteEngine On
RewriteBase /en/
# Removes index.php from ExpressionEngine URLs
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)/index\.php/*(.*) $1$2 [R=301,NE,L]
# add a trailing slash to directories
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{DOCUMENT_ROOT}/en/$1 -d
RewriteRule ^(.*?[^/])$ /en%{REQUEST_URI}/ [L,NE,R=302]
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>
目录删除
重新启动发动机
重写BASE/en/
#从ExpressionEngine URL中删除index.php
重写cond%{REQUEST_METHOD}!邮递
RewriteCond%{THE_REQUEST}^GET.*index\.php[NC]
重写cond%{REQUEST_URI}/系统/*[NC]
重写规则(.*)/index\.php/*(.*)$1$2[R=301,NE,L]
#在目录中添加尾部斜杠
重写cond%{REQUEST_METHOD}!邮递
重写cond%{DOCUMENT_ROOT}/en/$1-d
重写规则^(.*?[^/])$/en%{REQUEST_URI}/[L,NE,R=302]
#通过站点索引文件指示所有EE web请求
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L,QSA]
我检查过了,同样的问题不幸的是,用同样的问题进行评论是没有帮助的。你在做表格投递吗?打开Chrome开发工具,然后进行搜索,查看是否有301重定向或是您的表单操作导致了此情况。是的,它正在向“mysite.com/en/”发送表单,获取的url为“mysite.com/en/?/noresult/6bc629a9319d90a1e9703eaf2c00f7cd/”