Welcome! Log In Create A New Profile

Advanced

Re: Redirect www to no-www with variable (for multiple domains)?

July 07, 2013 08:22AM
Jonathan Matthews Wrote:
-------------------------------------------------------
> On 7 Jul 2013 10:30, "lennart" <nginx-forum@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
> _______________________________________________

As a newbie to NGINX (used 10yrs APACHE before) i don't know the exact route on the wiki & forum ;-). I also not found a newbie-section ;-) But off course, i shall post the solution.

Sajan tells about $host, i'll give it a try
SubjectAuthorPosted

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

lennartJuly 07, 2013 05:30AM

Re: Redirect www to no-www with variable (for multiple domains)?

Jonathan MatthewsJuly 07, 2013 07:44AM

Re: Redirect www to no-www with variable (for multiple domains)?

lennartJuly 07, 2013 08:22AM

Re: Redirect www to no-www with variable (for multiple domains)?

Sajan ParikhJuly 07, 2013 07:48AM

Re: Redirect www to no-www with variable (for multiple domains)?

Sajan ParikhJuly 07, 2013 02:48PM

Re: Redirect www to no-www with variable (for multiple domains)?

Edho AriefJuly 08, 2013 12:50AM

Re: Redirect www to no-www with variable (for multiple domains)?

lennartJuly 08, 2013 05:47PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 137
Record Number of Users: 5 on November 26, 2014
Record Number of Guests: 173 on November 26, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready