Redirect www to no-www with variable (for multiple domains)?
Jonathan Matthews
contact at jpluscplusm.com
Sun Jul 7 11:43:32 UTC 2013
On 7 Jul 2013 10:30, "lennart" <nginx-forum at nginx.us> wrote:
>
> 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" ;-)
Absolutely there are ways to do this all in one go. Have a try and let us
know where you get stuck :-)
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130707/9d646aaf/attachment.html>
More information about the nginx
mailing list