Title: Yet another redirect loop while trying to switch to a https only environment.
Last modified: September 1, 2016

---

# Yet another redirect loop while trying to switch to a https only environment.

 *  Resolved [johnny538](https://wordpress.org/support/users/johnny538/)
 * (@johnny538)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/yet-another-redirect-loop-while-trying-to-switch-to-a-https-only-environment/)
 * 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: [http://pastebin.com/raw/e4wYkVQy](http://pastebin.com/raw/e4wYkVQy)
   htaccess: [http://pastebin.com/raw/BUEexvHF](http://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 [http://](https://wordpress.org/support/topic/yet-another-redirect-loop-while-trying-to-switch-to-a-https-only-environment/?output_format=md).
 * 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 http:// 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 http:// links
   to [https://](https://wordpress.org/support/topic/yet-another-redirect-loop-while-trying-to-switch-to-a-https-only-environment/?output_format=md).
   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)

 *  [linux4me2](https://wordpress.org/support/users/linux4me2/)
 * (@linux4me2)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/yet-another-redirect-loop-while-trying-to-switch-to-a-https-only-environment/#post-7710361)
 * 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](https://wordpress.org/support/users/johnny538/)
 * (@johnny538)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/yet-another-redirect-loop-while-trying-to-switch-to-a-https-only-environment/#post-7710363)
 * 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](https://wordpress.org/support/users/johnny538/)
 * (@johnny538)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/yet-another-redirect-loop-while-trying-to-switch-to-a-https-only-environment/#post-7710434)
 * 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://%](https://%){HTTP_HOST}%{REQUEST_URI} [R=301,L]
 *  [linux4me2](https://wordpress.org/support/users/linux4me2/)
 * (@linux4me2)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/yet-another-redirect-loop-while-trying-to-switch-to-a-https-only-environment/#post-7710481)
 * 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.

## Tags

 * [HTTP](https://wordpress.org/support/topic-tag/http/)
 * [HTTPS](https://wordpress.org/support/topic-tag/https/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [redirect](https://wordpress.org/support/topic-tag/redirect/)
 * [SSL](https://wordpress.org/support/topic-tag/ssl/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [linux4me2](https://wordpress.org/support/users/linux4me2/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/yet-another-redirect-loop-while-trying-to-switch-to-a-https-only-environment/#post-7710481)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
