Hello boss
my website host on nginx 14.1 server with ubuntu 18.4 i install ssl letsencypty by Certbot
this way sudo certbot --nginx -d godsunsat.com -d www.godsunsat.com
this is my file /etc/nginx/sites-available/godsunsat.com

server {

    root /var/www/godsunsat.com/public_html;

   index index.php index.html index.htm index.nginx-debian.html;
    server_name www.godsunsat.in godsunsat.com;
    location / {

            try_files $uri $uri/ /index.php?$args;

    location ~ \.php$ {
            include snippets/fastcgi-php.conf;

            fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;


    location ~ /\.ht {
            deny all;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/godsunsat.com/fullchain.pem; # ma$
ssl_certificate_key /etc/letsencrypt/live/godsunsat.com/privkey.pem; # $
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


server {
if ($host = www.godsunsat.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

if ($host = godsunsat.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

   listen 80 default_server;
    listen [::]:80 default_server;
    server_name www.godsunsat.com godsunsat.com;
   return 301 https://www.godsunsat.com/$request_uri;
return 404; # managed by Certbot

My website open 2 url look this https://godsunsat.com and https://www.godsunsat.com
but I want it open like this url https://www.godsunsat.com/ please help how to fix
i am not developer Still work plz Show easy way

error chack this site https://check-your-website.server-daten.de/?q=godsunsat.com

this error

Error - no preferred version www or non-www. Select one version as preferred version, then add a redirect https + not-preferred version to https + preferred version. Perhaps in your port 443 vHost something like “RewriteEngine on” + “RewriteCond %{SERVER_NAME} = example.com” + “ReWriteRule ^ https://www.example.com%{REQUEST_URI} [END,QSA,R=permanent]” (three rows, without the "). That should create a redirect https + example.com ⇒ https + www.example.com. Or switch both values to use the non-www version as your preferred version.

Please help

edited by MattIPv4
Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!