我的问题是,当我尝试访问某个文件时,例如 http://domain.com/myFile.php?Key1=Value1&Key2=Value2 有时它有效,有时它会将我重定向到: https://domain.commyfile.php/?Key1=Value1&Key2=Value2 我将TLS添加到站点后将此问题开始(将http重定向到https工作正常,但出现此问题)。
我的.htaccess文件:
# Do not remove this line or mod_rewrite rules and search engine friendly URLs will stop working
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://mydomain$1 [R,L]
RewriteEngine On
RewriteCond %{HTTPS} on
谁能告诉我为什么会这样?
答案 0 :(得分:0)
您需要更改RewriteRule,因为基数为/
。执行以下操作:
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://mydomain/$1 [R,L]
RewriteEngine On
RewriteCond %{HTTPS} on