I want my entire site to use HTTPS, except for the home page due to a non-secure script there.
The site is using Apache/Slim.
Inside /etc/apache2/sites-available/000-default.conf
:
RewriteCond "%{REQUEST_URI}" “!=/”
RewriteRule . https://%{HTTP:Host}%{REQUEST_URI} [R=302,S=1]
#the usual Slim rule:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php
(Note the S=1
. That is supposed to skip the next rule if there's a match.)
Problem: I'm not being redirected and my css includes are not being served (I just get a copy of the home page html). Any suggestions?
Since I was using CarQuery, I was actually able to simply use CarQuery over HTTPS:
Change
<script type="text/javascript" src="http://www.carqueryapi.com/js/carquery.0.3.4.js"></script>
to:
<script type="text/javascript" src="https://www.carqueryapi.com/js/carquery.0.3.4.js"></script>
No more need to write fancy RewriteRules.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.