Title: About HTTPs enforce and .htaccess
Last modified: December 1, 2020

---

# About HTTPs enforce and .htaccess

 *  Resolved [西門 正 Code Guy](https://wordpress.org/support/users/simongcc/)
 * (@simongcc)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/about-https-enforce-and-htaccess/)
 * Hello! SG
 * I would like to consult about this option – Enforce HTTPS.
    AFAI try, checking
   this option adds the following settings to .htaccess
 *  RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^ [https://www.%](https://www.%){
   HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP:X-Forwarded-Proto} !https
   RewriteCond %{HTTPS} off RewriteRule ^ [https://%](https://%){HTTP_HOST}%{REQUEST_URI}[
   L,R=301]
 * But sometimes it only adds this
 *  RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^ [https://www.%](https://www.%){
   HTTP_HOST}%{REQUEST_URI} [L,R=301]
 * To what circumstance, it do not output ^www… ?
    Does this related to site builtin
   Cloudflare support? I am using the recommended free plan for some client sites.
   While I have also subscribed to Cloudflare Business for some other clients.
 * Many thanks.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Stoyan Georgiev](https://wordpress.org/support/users/stoyangeorgiev/)
 * (@stoyangeorgiev)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/about-https-enforce-and-htaccess/#post-13729692)
 * Hello there [@simongcc](https://wordpress.org/support/users/simongcc/),
 * If you are using www the following rules are added to the htaccess file
 *     ```
       RewriteCond %{HTTP_HOST} !^www\. [NC]\n
       RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
       ```
   
 * In order to redirect to [https://www](https://www). directly instead of
    requests
   to http:// and from then to https:// and from then to [https://www](https://www).
 * This one is used to redirect any requests from http:// to https://
 *     ```
       RewriteCond %{HTTP:X-Forwarded-Proto} !https
       RewriteCond %{HTTPS} off
       RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
       ```
   
 * So to sum up, if you are using your application without www, only the bottom 
   part of the rules will be added. if you are using it with www, the first one 
   will be added as well to skip those redirects from non-https to https and from
   there to [https://www](https://www).
 * Kind regards,
    Stoyan
    -  This reply was modified 5 years, 6 months ago by [Stoyan Georgiev](https://wordpress.org/support/users/stoyangeorgiev/).
    -  This reply was modified 5 years, 6 months ago by [Stoyan Georgiev](https://wordpress.org/support/users/stoyangeorgiev/).

Viewing 1 replies (of 1 total)

The topic ‘About HTTPs enforce and .htaccess’ is closed to new replies.

 * ![](https://ps.w.org/sg-cachepress/assets/icon-256x256.gif?rev=2971889)
 * [Speed Optimizer - The All-In-One Performance-Boosting Plugin](https://wordpress.org/plugins/sg-cachepress/)
 * [Support Threads](https://wordpress.org/support/plugin/sg-cachepress/)
 * [Active Topics](https://wordpress.org/support/plugin/sg-cachepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sg-cachepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sg-cachepress/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Stoyan Georgiev](https://wordpress.org/support/users/stoyangeorgiev/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/about-https-enforce-and-htaccess/#post-13729692)
 * Status: resolved