.htaccess HTTP到HTTPS重定向,不显示index.php
我将我的站点设置为HTTPS“”,因此我添加了一个htaccess文件,以便在通过HTTP访问网站时重定向到HTTPS 这是我从SO那里得到的密码.htaccess HTTP到HTTPS重定向,不显示index.php,.htaccess,redirect,.htaccess,Redirect,我将我的站点设置为HTTPS“”,因此我添加了一个htaccess文件,以便在通过HTTP访问网站时重定向到HTTPS 这是我从SO那里得到的密码 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} =http RewriteRule ^ https://%{HTTP_
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
当我访问时,它会重定向到正确的位置。但当我访问时,它会重定向到
url中有一个我不喜欢的
index.php
。有什么可能的解决方案吗?让您的代码如下:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
您不需要在行上有多个重写引擎,并在内部重写规则之前保留重定向规则,如图所示
测试前,请确保清除浏览器缓存