Question

Redirect Loop when redirect to HTTPS

Hi, i install a SSL certificate and it seems to work… If i go to any url and manually type https:// it have no trouble.

When i put https on the site URL of Wordpress settings the whole site breaks, the frontend may work but not the backend (redirect loop).

If i put the RewriteCond to force the https the whole page go to redirect loop…

I tried only activating the Force SSL on Chekout in Woocommerce and the whole site load on https but when i go to the checkout the loop is back.

The vhosts that i create in order to install de ssl is like this, i dont know if there a header set wrong so i share the complete content


###############################################################################
# Install SSL Certificate
###############################################################################

server {
    listen       443 ssl;
    listen       [::]:443 ssl;
    server_name
        vaporhookah.org
        www.vaporhookah.org
      ;

    ssl on;
    ssl_certificate /home/certs/vaporhookah_org/ssl-bundle.crt;
    ssl_certificate_key /home/certs/vaporhookah_org/ssl.key;

    root   /srv/users/serverpilot/apps/APPNAME/public;

    access_log  /srv/users/serverpilot/log/APPNAME/APPNAME_nginx.access.log  main;
    error_log  /srv/users/serverpilot/log/APPNAME/APPNAME_nginx.error.log;

    proxy_set_header    Host              $host;
    proxy_set_header    X-Real-IP         $remote_addr;
    proxy_set_header    X-Forwarded-For   $proxy_add_x_forwarded_for;

    include /etc/nginx-sp/vhosts.d/APPNAME.d/*.nonssl_conf;
    include /etc/nginx-sp/vhosts.d/APPNAME.d/*.conf;
}


(is serverpilot on NGINX so maybe you see some routes different.)

Is the problem in the vhost? i already tried almost everything i found on google but nothing seems to work… the recommended plugins do not work either…

Im losing my mind here.

Thanks on advance and sorry for my poor english.

Subscribe
Share

You might try changing WordPress’ WP_SITEURL and WP_HOME settings by adding the following to your wp-config.php file (use your own domain name rather than example.com):

define('WP_SITEURL', 'https://www.example.com');
define('WP_HOME', 'https://www.example.com');

I hope that helps.


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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This question was answered by @jsamuel:

You might try changing WordPress’ WP_SITEURL and WP_HOME settings by adding the following to your wp-config.php file (use your own domain name rather than example.com):

define('WP_SITEURL', 'https://www.example.com');
define('WP_HOME', 'https://www.example.com');

I hope that helps.

View the original comment