Title: No https redirect on cached sites
Last modified: September 28, 2022

---

# No https redirect on cached sites

 *  Resolved [dansart](https://wordpress.org/support/users/dansart/)
 * (@dansart)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/no-https-redirect-on-cached-sites/)
 * Hi
 * I noticed that the HTTPS redirect for cached URLs does not work.
    Modern browsers
   do redirect automatically, but not older browsers or on my Android phone.
 * With the default settings, this URL will be returned;
    [http://SITE/wp-content/cache/all//index.html](http://SITE/wp-content/cache/all//index.html)
 * If I use something the following code in the .htaccess to force HTTPS, it will
   return the un-cached version.
 *     ```
       # BEGIN Redirect HTTP to HTTPS
       RewriteEngine On
       RewriteCond %{HTTPS} !on
       RewriteCond %{SERVER_PORT} !^443$
       RewriteCond %{HTTP:X-Forwarded-Proto} !https
       RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
       # END Redirect HTTP to HTTPS
       ```
   
 * I could not find an option to redirect to the cached site.
    Could you include
   an option to activate redirect to HTTPS in your plugin? Thanks. Best, Daniel
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fno-https-redirect-on-cached-sites%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/no-https-redirect-on-cached-sites/#post-16050344)
 * Please take a look at the following tutorial.
    [https://www.wpfastestcache.com/tutorial/redirection-to-wp-contentcacheallindex-html-problem/](https://www.wpfastestcache.com/tutorial/redirection-to-wp-contentcacheallindex-html-problem/)
    -  This reply was modified 3 years, 8 months ago by [Emre Vona](https://wordpress.org/support/users/emrevona/).
 *  Thread Starter [dansart](https://wordpress.org/support/users/dansart/)
 * (@dansart)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/no-https-redirect-on-cached-sites/#post-16050884)
 * Hi Emre
 * Thanks for the fast reply.
    Unfortunately, the solution does not work. Tested
   with: [https://htaccess.madewithlove.com/](https://htaccess.madewithlove.com/)
 * If I go to
    `http://site.com` I’ll get
 *     ```
       RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
       The new url is http://SITE.com/wp-content/cache/all//index.html
       The tests are stopped because of the L in your RewriteRule options.
       ```
   
 * I should not add it to the WP fastest cache section. If I add it on top of everything,
   I’ll get:
 *     ```
       RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
       The new url is https://SITE.com/
       Test are stopped, a redirect will be made with status code 301
       ```
   
 * But it should be **https**://SITE.com/wp-content/cache/all//index.html
 * My .htaccess file:
 *     ```
       # BEGIN WpFastestCache
       # Modified Time: 12-08-22 16:15:27
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteCond %{HTTPS} =on
       RewriteCond %{HTTP_HOST} ^SITE.com
       # Start WPFC Exclude
       RewriteCond %{REQUEST_URI} !\/nh-login [NC]
       RewriteCond %{REQUEST_URI} !\/sesm2 [NC]
       RewriteCond %{REQUEST_URI} !\/sesm [NC]
       RewriteCond %{REQUEST_URI} !\/pos [NC]
       # End WPFC Exclude
       # Start_WPFC_Exclude_Admin_Cookie
       RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=dansart
       # End_WPFC_Exclude_Admin_Cookie
       RewriteCond %{HTTP_HOST} ^SITE.com
       RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WP_FASTEST_CACHE_CSS_VALIDATOR|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot)
       RewriteCond %{HTTP_USER_AGENT} !(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot)
       RewriteCond %{REQUEST_METHOD} !POST
       RewriteCond %{REQUEST_URI} !(\/){2}$
       RewriteCond %{REQUEST_URI} \/$
       RewriteCond %{QUERY_STRING} !.+
       RewriteCond %{HTTP:Cookie} !comment_author_
       RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil
       RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
       RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
       RewriteCond /home/SITE/public_html/wp-content/cache/all/$1/index.html -f
       RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
       </IfModule>
       <FilesMatch "index\.(html|htm)$">
       AddDefaultCharset UTF-8
       <ifModule mod_headers.c>
       FileETag None
       Header unset ETag
       Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
       Header set Pragma "no-cache"
       Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
       </ifModule>
       </FilesMatch>
       # END WpFastestCache
       # BEGIN GzipWpFastestCache
       <IfModule mod_deflate.c>
       AddType x-font/woff .woff
       AddType x-font/ttf .ttf
       AddOutputFilterByType DEFLATE image/svg+xml
       AddOutputFilterByType DEFLATE text/plain
       AddOutputFilterByType DEFLATE text/html
       AddOutputFilterByType DEFLATE text/xml
       AddOutputFilterByType DEFLATE text/css
       AddOutputFilterByType DEFLATE text/javascript
       AddOutputFilterByType DEFLATE application/xml
       AddOutputFilterByType DEFLATE application/xhtml+xml
       AddOutputFilterByType DEFLATE application/rss+xml
       AddOutputFilterByType DEFLATE application/javascript
       AddOutputFilterByType DEFLATE application/x-javascript
       AddOutputFilterByType DEFLATE application/x-font-ttf
       AddOutputFilterByType DEFLATE x-font/ttf
       AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
       AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
       </IfModule>
       # END GzipWpFastestCache
       # BEGIN LBCWpFastestCache
       <FilesMatch "\.(webm|ogg|mp4|ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|otf|ttf|svg|eot)(\.gz)?$">
       <IfModule mod_expires.c>
       AddType application/font-woff2 .woff2
       AddType application/x-font-opentype .otf
       ExpiresActive On
       ExpiresDefault A0
       ExpiresByType video/webm A10368000
       ExpiresByType video/ogg A10368000
       ExpiresByType video/mp4 A10368000
       ExpiresByType image/webp A10368000
       ExpiresByType image/gif A10368000
       ExpiresByType image/png A10368000
       ExpiresByType image/jpg A10368000
       ExpiresByType image/jpeg A10368000
       ExpiresByType image/ico A10368000
       ExpiresByType image/svg+xml A10368000
       ExpiresByType text/css A10368000
       ExpiresByType text/javascript A10368000
       ExpiresByType application/javascript A10368000
       ExpiresByType application/x-javascript A10368000
       ExpiresByType application/font-woff2 A10368000
       ExpiresByType application/x-font-opentype A10368000
       ExpiresByType application/x-font-truetype A10368000
       </IfModule>
       <IfModule mod_headers.c>
       Header set Expires "max-age=A10368000, public"
       Header unset ETag
       Header set Connection keep-alive
       FileETag None
       </IfModule>
       </FilesMatch>
       # END LBCWpFastestCache
   
       # BEGIN WordPress
       # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
       # dynamically generated, and should only be modified via WordPress filters.
       # Any changes to the directives between these markers will be overwritten.
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
       RewriteBase /
       RewriteRule ^index\.php$ - [L]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
       </IfModule>
   
       # END WordPress
   
       # Wordfence WAF
       <IfModule LiteSpeed>
       php_value auto_prepend_file '/home/SITE/public_html/wordfence-waf.php'
       </IfModule>
       <IfModule lsapi_module>
       php_value auto_prepend_file '/home/SITE/public_html/wordfence-waf.php'
       </IfModule>
       <IfModule Litespeed>
       RewriteEngine On
       RewriteRule .* - [E=noabort:1]
       </IfModule>
   
       <Files ".user.ini">
       <IfModule mod_authz_core.c>
       	Require all denied
       </IfModule>
       <IfModule !mod_authz_core.c>
       	Order deny,allow
       	Deny from all
       </IfModule>
       </Files>
   
       # END Wordfence WAF
       AddHandler application/x-httpd-php74 .php
       ```
   
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/no-https-redirect-on-cached-sites/#post-16052566)
 * your 301 redirection rule must be as below.
 *     ```
       # BEGIN Redirect HTTP to HTTPS
       RewriteEngine On
       RewriteCond %{HTTPS} !on
       RewriteCond %{SERVER_PORT} !^443$
       RewriteCond %{HTTP:X-Forwarded-Proto} !https
       RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache)
       RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
       # END Redirect HTTP to HTTPS
       ```
   
 *  Thread Starter [dansart](https://wordpress.org/support/users/dansart/)
 * (@dansart)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/no-https-redirect-on-cached-sites/#post-16058549)
 * Thanks. It worked but not the way I like to have it.
    It should redirect to https
   AND redirect to the cached files…
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/no-https-redirect-on-cached-sites/#post-16058590)
 * you are welcome 🙂 if you vote, you make me so happy. 
    [https://wordpress.org/support/plugin/wp-fastest-cache/reviews/](https://wordpress.org/support/plugin/wp-fastest-cache/reviews/)
    -  This reply was modified 3 years, 8 months ago by [Emre Vona](https://wordpress.org/support/users/emrevona/).

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘No https redirect on cached sites’ is closed to new replies.

 * ![](https://ps.w.org/wp-fastest-cache/assets/icon-256x256.png?rev=2064586)
 * [WP Fastest Cache - WordPress Cache Plugin](https://wordpress.org/plugins/wp-fastest-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-fastest-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-fastest-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-fastest-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-fastest-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-fastest-cache/reviews/)

## Tags

 * [caching](https://wordpress.org/support/topic-tag/caching/)
 * [HTTPS](https://wordpress.org/support/topic-tag/https/)
 * [redirect](https://wordpress.org/support/topic-tag/redirect/)

 * 5 replies
 * 2 participants
 * Last reply from: [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/no-https-redirect-on-cached-sites/#post-16058590)
 * Status: resolved