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/ genupdates.com file

server {


server_name www.genupdates.com;


access_log /var/log/nginx/genupdates.com.access.log rt_cache;
error_log /var/log/nginx/genupdates.com.error.log;


root /var/www/genupdates.com/htdocs;



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/genupdates.com/conf/nginx/*.conf;

(2) /etc/nginx/conf.d/ force-ssl-genupdates.com.conf file

server {
listen 80;
server_name www.genupdates.com genupdates.com;
return 301 https://www.genupdates.com$request_uri; 
}

(3) /var/www/genupdates.com/conf/nginx/ ssl.conf file

listen 443 ssl http2;
ssl on;
ssl_certificate     /etc/letsencrypt/live/genupdates.com/fullchain.pem;
ssl_certificate_key     /etc/letsencrypt/live/genupdates.com/privkey.pem;

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 https://genupdates.com/ is not redirected to https://www.genupdates.com/ ( not working )

but

Non-SSL site http://genupdates.com/ is redirecting to https://www.genupdates.com/ (Working)

What is wrong with https://genupdates.com/ and why it is not redirecting to www

I see.

Try this:

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

server {

server_name genupdates.com www.genupdates.com;

Thanks but not worked!

server {


server_name genupdates.com;


access_log /var/log/nginx/genupdates.com.access.log rt_cache; 
error_log /var/log/nginx/genupdates.com.error.log;

Reloaded as well as restarted nginx

Put both non-www and www

server {

server_name genupdates.com www.genupdates.com;

: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 www.genupdates.com

or

ee site create genupdates.com

1 Like

Yes :confused:

ee site create www.genupdates.com --wpfc --letsencrypt

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

ee site create genupdates.com --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: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

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