dacevedo
By:
dacevedo

Redirect Loop when redirect to HTTPS

April 18, 2015 2.5k views
Control Panels Nginx Security Ubuntu

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.

1 comment
  • 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.

1 Answer

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

Have another answer? Share your knowledge.