Welcome! Log In Create A New Profile

Advanced

Re: Require 'www' for https://example.com

March 22, 2013 07:52PM
# www fix
server {
# www.example.com -> example.com
#server_name www.example.com;

#rewrite ^ $scheme://example.com$request_uri? permanent;
# www.example.com -> example.com
server_name example.com;

rewrite ^ $scheme://www.example.com$request_uri? permanent;
}


https://github.com/kirpit/webstack/blob/master/sites/_nginx-example.com.conf

cheers.





On Sat, Mar 23, 2013 at 12:44 AM, openletter <nginx-forum@nginx.us> wrote:

> I am setting up a server that will be for a B2B business, and I want the
> whole site to be served as https://www.example.com/
>
> I have gotten a certificate and https://www.example.com runs just fine,
> but
> I can't figure out how to require https://www.example.com when a user
> tries
> to go to https://example.com.
>
> In reading through the nginx.org site, it seems like rewrites and if
> statements are discouraged. I did figure out how to require
> http://www.example.com/ by using the following in my server block file:
>
> server {
> listen [::]:80;
> server_name example.com *.example.com;
> return 301 $scheme://www.example.com$request_uri;
> }
>
> But doing something similar for 443 doesn't seem to work.
>
> Can someone please help me out or point to a good page on setting up for
> this?
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,237695,237695#msg-237695
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Require 'www' for https://example.com

openletter March 22, 2013 06:44PM

Re: Require 'www' for https://example.com

roy.enjoy March 22, 2013 07:52PM

Re: Require 'www' for https://example.com

António P. P. Almeida March 22, 2013 11:02PM

Re: Require 'www' for https://example.com

Igor Sysoev March 23, 2013 01:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready