Redirect www to no-www with variable (for multiple domains)?
lennart
nginx-forum at nginx.us
Mon Jul 8 21:47:12 UTC 2013
Edho Arief Wrote:
-------------------------------------------------------
> On Sun, Jul 7, 2013 at 6:30 PM, lennart <nginx-forum at nginx.us> wrote:
> >
> > 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"
> ;-)
> >
>
> the regex way, which is supposedly slower:
>
> server {
> server_name ~^www\.(?<domain>.+)$;
> listen 80; listen [::]:80;
> return 301 $scheme://$domain$request_uri;
> }
>
> --
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
'supposedly slower' is a very good argument to not use RegEx ;-) Do you have
a source for that?
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,240622,240679#msg-240679
More information about the nginx
mailing list