Non www SSL site not redirecting to www SSL site


#1

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:


#2

What’s your WordPress > Settings > General says?


#3

See this :smiley:


#4

Anybody here to help?


#5

I’m getting SSL when visiting your website.


#6

@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


#7

I see.

Try this:

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

server {

server_name genupdates.com www.genupdates.com;


#8

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


#9

Put both non-www and www

server {

server_name genupdates.com www.genupdates.com;


#10

: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.


#11

or any other way to do it with DNS


#12

Did you create the site with:

ee site create www.genupdates.com

or

ee site create genupdates.com


#13

Yes :confused:


#14

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


#15

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?


#16

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


#17

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


#18

Hey @genupdates, Do share your config bro.

Thank you.


#19

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.


#20

Sorry I was offline