如果我了解您,以下代码将解决此问题:
RewriteEngine On
RewriteCond %{HTTPS} =off
RewriteCond %{SCRIPT_FILENAME} !\/index\.php [NC]
#the above line will exclude /index.php
# from the following rules
RewriteCond %{SCRIPT_FILENAME} !\/dealers\.php [NC]
# the above line will exclude the /dealers.php
# from the following rules
RewriteRule (.+) https://%{HTTP_HOST}/$1 [L,R=301]
# above line will force every pages and directories ,except those who
# excluded above and the main root , to redirect from http to https
# (.+) means not to consider / and if you
# change it by (.*) it will be considered
现在,您可以强制将整个网站从http重定向到https,但和/dealers除外。
注意:在测试上述代码之前,请确保您清空浏览器缓存