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

Redirect www to no-www with variable (for multiple domains)? (6 replies)

$
0
0
According to http://wiki.nginx.org/Pitfalls#Server_Name this is the best solution to redirect www to no-www for one domain:

server {
server_name www.domain.com;
return 301 $scheme://domain.com$request_uri;
}
server {
server_name domain.com;
[...]
}

Is there a way to do this with regex or variables? I've ~15 domains and it would be more convenient to have only one entry "to rule them all" ;-)

Viewing all articles
Browse latest Browse all 7229

Trending Articles



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