After switching to https://, all of our articles have lost their Facebook \"Like\" count. So I would like to disable https just for the Content area of our website, which is at
You'll need to make a change to your first rule to exclude content.php
. The you simply add a rule for content.php
that will do exactly the opposite of your other rule. You can add the [R=301]
flag if your rules do what you expect them to do to turn them into permanent redirects. Permanent redirects are cached by the browser and will reduce the amount of requests done to your server. You don't need to use a capturing group for your first rule, and therefore I just used the ^
syntax, which matches every request.
RewriteEngine on
#Turn the entire site into https, except for content.php
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/content\.php$
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
#Use http instead for this url
RewriteCond %{HTTPS} on
RewriteCond ^content\.php$ http://%{HTTP_HOST}%{REQUEST_URI}