Report this

What is the reason for this report?

Redirect www to non www

Posted on February 12, 2014

How do I redirect http://www.example.com to http://example.com?

I am using LEMP, Nginx, Wordpress.

Qn 1: To which file should I add the below code to?

server { server_name www.example.com; return 301 $scheme://example.com$request_uri; }

I have a few files in mind (I followed your tutorials)

  1. /etc/nginx/sites-available/wordpress
  2. /etc/nginx/sites-available/default

Qn 2: If I add the above code, must I still do the DNS part on CNAME (www and @)? Or can I skip this step?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.