[website] www to naked domain redirect

Bruce Dubbs bruce.dubbs at gmail.com
Mon Jun 8 13:06:42 PDT 2015


Robert Sink wrote:
> here's a simple nginx example:
> server {
> listen 80;
> server_name www.linuxfromscratch.org;
> # $scheme will get the http protocol
> # and 301 is best practice for tablet, phone, desktop and seo.
> # 301 is permanent if you plan on changing use 302
> return 301 $scheme://domain.com$request_uri;
> }
> server {
> listen 80;
> server_name linuxfromscratch.org;
> # here goes the rest of your config file
> # example
> location / { rewrite ^/cp/login?$ /cp/login.php last;
>      # etc etc...
>       }
> }
>
> Regards,
> Rob
>
> P.S.  Many DNS providers also have capability.  Like setup a www cname.  Good luck.

We do have

$ORIGIN linuxfromscratch.org.
...
higgs           IN      A       192.155.86.174
www             IN      CNAME   higgs

   -- Bruce


More information about the website mailing list