Remove www to non-www redirect


#1

Hi

I have been doing some testing with ee4 for the past couple of weeks and yesterday I moved a live site to my ee4 server. The results have been impressive with almost double page views and a similar increase in ad revenue. Because of this I plan to move my other sites but have one thing I need to fix first.

  1. www to non-www redirect. My sites currently use www.domain.com and I would like to keep this. But when I use “ee site create domain.com” everything redirects to domain.com. I tried using “ee site create www.domain.com” and this worked but when I use the --ssl=le option this only creates a cert for www.domain.com, so if someone visits https://domain.com they get a cert error. When I use the --ssl=le option on the non www domain it creates a cert for both non-www and www domains.

How can I remove the www to non-www redirect and have a non-www to www redirect for my sites? Either in a global config or per site config.

Thanks

Rob


#2

What about creating the --wildcard LE cert?

EE should create the non-www cert though. This appears to be a bug.


#3

I tried the wildcard but couldn’t get it to work. I added both the txt records to my DNS but the SSL auth failed. I have verified that there is no non-www cert created by using sslchecker.com


#4

Put Cloudflare in front of it and redirect the non-www to www. That might work for now.


#5

Thanks. I will give that a try


#6

Hi

After a bit of playing around, I found a way to get rid of the redirect.

In the /opt/easyengine/services/nginx-proxy/conf.d/ folder you will find a redirect conf file for each site. I simply renamed this (rather than delete it), restarted the site and now I can connect to the www version of the site.

Not sure if this is the ideal way to do it but it seems to have the desired effect. I would like to ask the experts here is doing this is a good or bad idea?

Thanks

Robert


#7

Hi

Just a quick update on this if anyone is interested.

creating a site with the www prefix now works. Not sure if there has been an update or just messed up. but the command ee site create www.domain.com --type=wp --cache --with-local-redis --ssl=le

this creates cert for both non and www domain and sets up the non-ww to www redirect.

Thanks


#8

what if i already create site without www? www.domain.com didn’t work but domain.com work just fine… how can i redirect (or update) so user can access both with www and without. ?


#9

Hello,

I need non-www (naked domain) to forward to www. So domain.com to www.domain.com. I ran the below command using a sudo user:

sudo ee site create www.domain.com --type=wp --ssl=le --wildcard

I added the txt records and ran sudo ee site ssl www.domain.com once the records propagated. The SSL successfully installed. When I visit domain.com I get an SSL error but when I visit www.domain.com everything works great.

I have tried multiple times and when creating the site using www, the non-www doesn’t forward. Any suggestions?


Command manual easyengine update [ubuntu 16.04]
#10

Hello,

After some digging and testing most of the day I discovered that if you set up EE or create the website with a sudo user, the redirect wont work. You have to create it using root. You also need to have a sudo user created or you cant update or download any plugins.

So for the redirect to work and WP to be able to install/update plugins and themes you need to make sure you have a sudo user setup. Then you need to use root to setup EE and WP.

It does work but it is not the best way to run. Hopefully a update is rolled out soon so that many of these bugs are fixed. I feel like many users are abandoning EE and using other tools.

Any updates in the pipeline?

Thank you


#11

After seeing this . I updated my ee4 and created a website with www. It’s working greatly . I was very happy . But I created another website with www. This one is not working . It’s not going to www. Version of the site . it’s going to 1st website of this server if I type the url without www. Need help . Sorry for bad English


#12

I have this problem too, I have created a website already without a www and at the moment it redirects all www to a non-www address.

Is there a way to change this without having to delete and restore the website?


#13

I have same question.


#14

Create a custom config file with the desired redirect in the following directory:

/var/lib/docker/volumes/global-nginx-proxy_confd/_data/

Do not make changes to the default.conf. EE rebuilds this with any changes you do.