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


My website dosen't open when prefix www