.htaccess force redirect of https://www to https:// not working

I know there are a ton of the posts concerning this very issue, but I cannot for the life of me get it to work.

The non-https www or non-www redirects work fine, but I cannont get the https://www redirect to work without getting the untrusted certificate warning.

Read More

My .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ https://arfcc.com/$1 [R=301,L]

I have cleared the cache and retested to no avail.

Any ideas?

Thanks!

Related posts

1 comment

  1. This a common catch-22. You need to redirect to the proper hostname to match your SSL cert, BUT, an SSL Handshake has to be established BEFORE any Rewrites can be executed. Most of the webserver’s config will not be available until the SSL Handshake and tcp connection is established… including Rewrites.

    The most common approach is to use a wildcard and/or SAN certificate to accommodate multiple hostnames.

    You can find many articles that cover this, but the following is pretty good:

    http://www.jasonsamuel.com/2011/03/07/how-to-properly-use-ssl-redirects-without-getting-certificate-error-messages/

Comments are closed.