从http重定向到https时MVC路由错误

时间:2018-05-22 17:51:48

标签: php .htaccess

我有这样的.htaccess MVC应用程序:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?$1 [L,QSA]

我想将所有http重定向到htpps,所以我改变.htaccess像这样:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteCond %{SERVER_PORT} 80 [OR]
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://example.com/index.php?$1 [L,QSA]

但似乎我错误地做了,因为假设为空白的查询字符串变为'index.html.var'。那我怎么解决呢?

0 个答案:

没有答案