Wildcard domain redirect to www results in www.www.domain.com
I'm trying to configure OpenResty (nginx) to redirect any non www domain
to www. one
but the thing that i'm acheiving is this : www.www.domain.com
eh?
here are my server blocks
server {
listen 80;
server_name ^$http_host$;
return 301 http://www.$http_host$request_uri;
}
server {
listen 80;
server_name ~^(www.)$$http_host;
location = / {
content_by_lua '
ngx.say("Host: ", ngx.req.get_headers()["Host"])
';
}
}
any help is greatly appreciated.
No comments:
Post a Comment