Non www SSL site not redirecting to www SSL site

I am having a problem with my site. I have also tried many solution posted on this topic but I got no success. Here is my config files:

(1) /etc/nginx/sites-available/ file

server {


access_log /var/log/nginx/ rt_cache;
error_log /var/log/nginx/;

root /var/www/;

index index.php index.html index.htm;

include common/wpfc-php7.conf;  

include common/wpcommon-php7.conf;
include common/locations-php7.conf;
include /var/www/*.conf;

(2) /etc/nginx/conf.d/ file

server {
listen 80;
return 301$request_uri; 

(3) /var/www/ ssl.conf file

listen 443 ssl http2;
ssl on;
ssl_certificate     /etc/letsencrypt/live/;
ssl_certificate_key     /etc/letsencrypt/live/;

What’s wrong ? Please help? Thanks in advance :blush:

What’s your WordPress > Settings > General says?

See this :smiley:

Anybody here to help?

I’m getting SSL when visiting your website.

@faizi The question is:

SSL site is not redirected to ( not working )


Non-SSL site is redirecting to (Working)

What is wrong with and why it is not redirecting to www

I see.

Try this:

in /etc/nginx/sites-available/ , insert the domain without www

server {


Thanks but not worked!

server {


access_log /var/log/nginx/ rt_cache; 
error_log /var/log/nginx/;

Reloaded as well as restarted nginx

Put both non-www and www

server {


:cry: :cry: :cry: No Luck, is there any way to do it with wordpress. I think all server config is good and I have reinstalled site on a new server. All config files are untouched.

or any other way to do it with DNS

Did you create the site with:

ee site create


ee site create

1 Like

Yes :confused:

ee site create --wpfc --letsencrypt

could you try recreate the site with non-www domain,

ee site create --wpfc --letsencrypt

and what are your digital ocean dns entry?

@faizi Hey, I have fixed the problem. I have edited ssl config file and /sites-available/ vhost file

@genupdates mind sharing with us what update you make to the file?

1 Like

Hey @genupdates, Do share your config bro.

Thank you.

1 Like

From your configuration, I can see no issues except what @faizi suggests as an addition. I assume that this issue had to do with the db entries of WP, so sharing your workaround would help others for sure aswell.

In case you have issues in the future, this tool might be a saving one:

Its actually a db tool that helps you replace every text instance. It also includes serialized data. Replacing every http:// instance with https:// works like charm and solved strange issues to the WP, in case EE config is just fine, like in your case.

Sorry I was offline