redirect wildcard subdomains to https (nginx)
Posted
by
whatWhat
on Server Fault
See other posts from Server Fault
or by whatWhat
Published on 2012-11-09T21:45:11Z
Indexed on
2012/11/09
23:04 UTC
Read the original article
Hit count: 151
I've got a wildcard ssl certification and I'm trying to redirect all non-ssl traffic to ssl. Currently I'm using the following for redirection the non-subdomainded url which is working fine.
server {
listen 80;
server_name mydomain.com;
#Rewrite all nonssl requests to ssl.
rewrite ^ https://$server_name$request_uri? permanent;
}
when I do the same thing for *.mydomain.com it logically redirects to
https://%2A.mydomain.com/
How do you redirect all subdomains to their https equivalent?
© Server Fault or respective owner