<p dir="ltr"><br>
On 7 Jul 2013 10:30, "lennart" <<a href="mailto:nginx-forum@nginx.us">nginx-forum@nginx.us</a>> wrote:<br>
><br>
> According to <a href="http://wiki.nginx.org/Pitfalls#Server_Name">http://wiki.nginx.org/Pitfalls#Server_Name</a> this is the best<br>
> solution to redirect www to no-www for one domain:<br>
><br>
> server {<br>
> server_name <a href="http://www.domain.com">www.domain.com</a>;<br>
> return 301 $scheme://<a href="http://domain.com">domain.com</a>$request_uri;<br>
> }<br>
> server {<br>
> server_name <a href="http://domain.com">domain.com</a>;<br>
> [...]<br>
> }<br>
><br>
> Is there a way to do this with regex or variables? I've ~15 domains and it<br>
> would be more convenient to have only one entry "to rule them all" ;-)</p>
<p dir="ltr">Absolutely there are ways to do this all in one go. Have a try and let us know where you get stuck :-)</p>
<p dir="ltr">Jonathan</p>