Reputation: 1886
I currently have a two mod_rewrite rules set up in my .htaccess file
rewriteCond %{HTTP_HOST} ^mysite.org [NC]
rewriteRule ^(.*)$ https://www.mysite.org/$1 [R=301,L]
rewriteCond %{SERVER_PORT} =80
rewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI}
The former being to redirect any traffic from mysite.org -> https://www.mysite.org, the latter picking up anything on port 80 (http) and send it to https.
But the admin control panel for my CMS is not accessible via https so I need to be able to access anything with the sub-domain mysite.org/admin
via http.
Is this possible?
Upvotes: 1
Views: 135
Reputation: 785108
You can create an exception for admin:
rewriteCond %{HTTP_HOST} ^mysite.org [NC]
rewriteRule ^(.*)$ https://www.mysite.org/$1 [R=301,L]
rewriteCond %{SERVER_PORT} =80
rewriteRule ^((?!admin).*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Upvotes: 1