Php .htaccess重写为https
因此,我想做以下工作:Php .htaccess重写为https,php,ssl,Php,Ssl,因此,我想做以下工作: 如果用户试图转到index.php以外的网站的一部分,他们将被重定向到https版本 因此,如果他们试图转到example.com/index.php,他们不会被重定向到https版本 但是,如果他们访问index.php(比如welcome.php)以外的站点的任何部分,就会被重定向到https版本 以下是我以前如何进行完整站点https重定向(我不确定如何在index.php上进行完整站点重定向到https示例) 为了将除索引之外的所有页面重定向到https,请将以下
为了将除索引之外的所有页面重定向到https,请将以下内容添加到.htaccess文件中:
RewriteCond %{HTTPS} !on
RewriteRule !^(index)\.php$ https://%{HTTP_HOST}%{REQUEST_URI}
可以使用括号内的管道字符添加其他异常,如下所示:
RewriteRule !^(index|about|contact)\.php$ https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule !^(index|about|contact)\.php$ https://%{HTTP_HOST}%{REQUEST_URI}