• Resolved johnny538

    (@johnny538)


    I’m using WordPress 4.6 with WooCommerce 2.6.4. I’ve been trying to get switched over to HTTPS for two weeks now but I just can’t for the love of God manage to succeed.

    Theme: Flatsome 2.9.6
    Plugins: https://pastebin.com/raw/e4wYkVQy
    htaccess: https://pastebin.com/raw/BUEexvHF

    I’ve read every article, followed every tutorial, asked on #wordpress on irc, but to no avail.

    When I change the site and home url to https, I get stuck in a redirect loop. The only way out is to alter the wp_options DB and change it back.

    When it’s set to http and I disable the htaccess redirect, I can access the page but with mixed content destroying the css. To fix it, I use the WordPress HTTPS plugin. Then when I enable the htaccess redirect as well, I can browse my site in 100% https, although through an ugly method imo.

    The problem is is that some plugins use the site or home url as base for the functionality. I use the WooCommerce POS plugin from CodeCanyon when opening a register it won’t load cause it keeps making xmlhttprequests to https://.

    It’s not respecting the HTTPS plugin, nor the htaccess rules.

    Aside from this plugin, I’ve tried disabling ALL plugins and switch to TwentySixteen theme for testing purposes, and even then I can’t get HTTPS to work when setting it in Settings>General as home and site URL. Always getting a redirect loop.

    A proper solution for me would be to get HTTPS working without any plugins. Making sure to redirect user when hitting https:// is done in the htaccess. I hope it will fix the plugin issues as well. I’ve tried different types of rewrite rules but all seem to cause a loop except the one I’m using now. I’ve also tried the seachreplace plugin and a webapp which does the same to replace https:// links to https://. But, again, not fixing my problem.

    I’m at a total loss. Any help is appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • For HTTPS sites running Woocommerce, I set the home and site URLs in General Settings to the https:// for the domain, and use the following in .htaccess:

    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    In Woocommerce -> Checkout, I have “Force secure checkout” checked.

    If that doesn’t work for you with the TwentySixteen theme and no plugins other than Woocommerce without a redirect loop, I think you should contact your hosting company’s tech support and see if they can identify an issue with the server that’s causing the redirect problem. It’s usually because the variable you’re using in your .htaccess isn’t one that the server uses.

    Once you get that working, you can worry about changing all the paths in your wp_posts table and widgets to HTTPS. I normally just run a query to change them all using phpMyAdmin, and manually change any paths to images I’ve put in a text widget.

    Thread Starter johnny538

    (@johnny538)

    Disabled all plugins except WooCommerce and switched to TwentySixteen. After applying those htaccess rules both the front and back end get in a redirect loop

    UPDATE: weird thing is, one in x refreshes actually retrieves the page. But after refreshing again it goes into a loop again.

    Thread Starter johnny538

    (@johnny538)

    I solved it. I contacted the hosting company and it appears I needed different https headers. The host returns HTTPS:https instead of HTTPS:On

    The following rules in htaccess solved it.

    RewriteEngine On
    RewriteRule .* – [e=HTTPS:On]
    RewriteCond %{SERVER_PORT} 80
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

    Excellent! I’m glad you got it working.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Yet another redirect loop while trying to switch to a https only environment.’ is closed to new replies.