WordPress, WP-Super Cache, and https: for the Insecure
One problem I’ve encountered with google search results, is that google will assume a site is https: whenever possible.
This the work-around I’ve implemented to redirect https: to http: by overriding the .htaccess file for Apache.
The downside is that WP Super Cache may overwrite the .htaccess file when any pages are changed, so keep a backup copy of .htaccess on your server ready in case it needs to be replaced. The bolded lines can be added, and comment out https: related lines
# Redirect HTTPS to HTTP
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# BEGIN WPSuperCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#If you serve pages from behind a proxy you may want to change ‘RewriteCond %{HTTPS} on’ to something more sensible
AddDefaultCharset UTF-8
# RewriteCond %{REQUEST_URI} !^.*[^/]$
# RewriteCond %{REQUEST_URI} !^.*//.*$
# RewriteCond %{REQUEST_METHOD} !POST
# RewriteCond %{QUERY_STRING} ^$
# RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
# RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\”]+ [NC]
# RewriteCond %{HTTP:Profile} !^[a-z0-9\”]+ [NC]
# RewriteCond %{HTTP:Accept-Encoding} gzip
# RewriteCond %{HTTPS} on
# RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz -f
# RewriteRule ^(.*) “/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz” [L]
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\”]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\”]+ [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{HTTPS} !on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz -f
RewriteRule ^(.*) “/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz” [L]
# RewriteCond %{REQUEST_URI} !^.*[^/]$
# RewriteCond %{REQUEST_URI} !^.*//.*$
# RewriteCond %{REQUEST_METHOD} !POST
# RewriteCond %{QUERY_STRING} ^$
# RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
# RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\”]+ [NC]
# RewriteCond %{HTTP:Profile} !^[a-z0-9\”]+ [NC]
# RewriteCond %{HTTPS} on
# RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html -f
# RewriteRule ^(.*) “/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html” [L]
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\”]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\”]+ [NC]
RewriteCond %{HTTPS} !on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f
RewriteRule ^(.*) “/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html” [L]
</IfModule>
# END WPSuperCache
Many people also recommend checking the following box on the CDN option page for WP Super Cache Settings, and then clicking ‘Save Changes’: