Create site with www?

How do I create wordpress sites with www in the domain? I tried this command ee site create www.example.com --w3tc but when I try going to the domain it doesn’t add the www to the url

You don’t need to specify www in the domain when creating site with ee, just use ee site create example.com and it will add the following line into your nginx config file server block:

`server {

    server_name example.com www.example.com;

. . . . . . . . . . . . . . . . . .`

So both www and w/o domain will resolve to the same website, just make sure you add a CNAME record pointing www to the main site at your DNS management site or hosting.

But the thing is I want the non-www to be redirected to the www domain cause everytime I go to a www.example.com it goes to example.com instead of www.example.com

Take a look at this article then: https://easyengine.io/tutorials/nginx/www-non-www-redirection/

Right now there are two types of www redirection on your site: by nginx and by WordPress.

EasyEngine’s nginx default setting covers both www and non-www. If you type this on address bar, both will work:

example.com/wp-content/uploads/2016/06/10/image.jpg

www.example.com/wp-content/uploads/2016/06/10/image.jpg

but if you call WordPress, for example:

example.com/post-one

WordPress will check your site configuration whether it www or non-www by looking value on Settings > General > WordPress Address (URL) and Site Address (URL)

Please add www on your Settings > General > WordPress Address (URL) and Site Address (URL) then Save Changes

1 Like