因此,我想做以下几点:
。
下面是我以前是如何完成完整站点https重定向的(我不确定如何在index.php上完成完整站点重定向到https示例)
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ https://www.handybook.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} !^www.example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php发布于 2012-06-23 21:42:07
为了拥有除索引重定向到https之外的所有页面,请将以下内容添加到.htaccess文件中:
RewriteCond %{HTTPS} !on
RewriteRule !^(index)\.php$ https://%{HTTP_HOST}%{REQUEST_URI}可以在括号内使用管道字符添加其他异常,如下所示:
RewriteRule !^(index|about|contact)\.php$ https://%{HTTP_HOST}%{REQUEST_URI}https://stackoverflow.com/questions/11172598
复制相似问题