Forum Moderators: phranque
Demo version:
<IfModule mod_rewrite.c>
RewriteEngine On
# Force SSL for CP requests
RewriteCond %{HTTP_HOST} ^example\.com [NC]
# RewriteCond %{REQUEST_URI} ^/admin/ [NC]
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
</IfModule> [edited by: phranque at 11:03 am (utc) on Mar 21, 2018]
[edit reason] unlinked url [/edit]
RewriteEngine On
# Force secure protocol and canonical hostname for CP requests
RewriteCond %{HTTP_HOST} !^(example\.com)?$ [NC,OR]
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301] [edited by: phranque at 4:05 am (utc) on Mar 22, 2018]