I'm trying to redirect anyone who access the admin section of my site to the HTTPS version of it. The current rewrite rule is as follows:
server {
listen 80;
server_name domain.com;
location / {
index index.php index.html;
root /home/domain.com/public;
}
#Redirect Admin requests to secure server
location /www/admin/ {
rewrite ^/(.*) https://domain.com$1 permanent;
}
}
The problem with this rule is it is only forwarding http://domain.com/www/admin
to HTTPS - going to http://domain.com/www/admin/index.php
, for example, does not redirect. Any idea how to correct this so that anything BELOW /www/admin
also gets redirected?