Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

Q: about "best" way for remove www in hostname in nginxish (5 replies)

$
0
0
Dear readers,

after reading

http://nginx.org/en/docs/http/server_names.html#regex_names

and googleing

https://www.google.at/search?q=nginx+remove+www+subdomain

I have a 'best solution' question.

I have the following customer request.

The 'normal User' type almost every time a www.subdomain.domain.at into
they browser,
which does not exist but the subdomain.domain.at exists.

I would now add the follwing into my nginx.conf.

###
server {
server_name ~^(www\.)?(?<domain>.+)$;

return http://$domain/;
}
###

Is this the cleanest way in nginxish?

Thanks for help
Aleks

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>