NiBE
NiBE

Reputation: 927

The page isn’t redirecting properly in HTTPS

I use nginx server and Prestashop 1.7.4.4 on a centos7, php5.6 is also installed. I configure nginx to serve 3 website, one in wordpress, one is a proxy torwards a Tomcat and one is with prestashop.

Everything is fine without HTTPS. I install certbot for the certificate, and run it. It did what it has to do with the 3 sites file configuration. All sites beside prestashop now works fine and if one try to connect in HTTP is redirected to HTTPS.

I install prestashop by command line like this:

 php index_cli.php --name=name --country=it --domain=www.namedoamin.com --db_server=127.0.0.1 --db_name=dbname --db_user=dbuser --db_password=password

without https it works fine, but once I installed the certificate and redirect the traffic from http to https the browser says the infamous:

The page isn’t redirecting properly

There are plenty of info about this issue but none helps me. This is the block from nginx:

server {
    server_name  www.name.com;
    location / {
        root   /var/www/html/website.com;
        index  index.php index.html index.htm;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    location ~ \.php$ {
        root           /var/www/html/website.com;
        fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param QUERY_STRING $query_string;
        include         /etc/nginx/fastcgi_params;
    }



listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.namesite.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.namesite.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

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


    server_name  www.namesite.com;
     listen 80;
   return 404; # managed by Certbot
  }

If I go in admin section it works in HTTPS, but if i try to go in settings/general it gives me 404 not found, very weird! I have no idea what to do anymore I'm desperate, I try all the tricks I red on internet before posting.

UPDATE: As often as soon as I post few hours later I find a workaround. Here the problem wat that I could not access the settings/general for whatever reason I don't know. So I went in the DB, table pl_configuration and change to true the fields called PS_SSL_ENABLED_EVERYWHERE and PS_SSL_ENABLED

Upvotes: 1

Views: 3585

Answers (1)

Tritof
Tritof

Reputation: 169

I had the same issue at first but then changing (in the administration interface of) the shop parameters > General by enabling ssl on every pages (first enable ssl, then save, then enable ssl on all pages), plus clearing the cache and then it worked fine.
In case it helps.

Upvotes: 1

Related Questions