0

I'm trying to set up SSL on a Wordpress site. The SSL certificate does not cover both www. and non-www. versions of the URL, so I'm trying to simply redirect everything to https://domain.tld with RewriteRules. I've scoured Google and found a couple solutions that should work

RewriteEngine on
RewriteCondition %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] 

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

Both of these do seem to redirect, but, the page doesn't load. Instead, _index.html_gzip downloads. There are some other mod_rewrite rules present that aren't normally included with the Wordpress htaccess.

I'm not very experienced with mod_rewrite and I'm totally confused at this point.

Carnivoris
  • 187
  • 1
  • 1
  • 3
  • I'm asking a specific question, not about general rules. AFAIK, the rules I'm using are correct, but producing unexpected results. – Carnivoris Sep 17 '13 at 19:26
  • The issue was that this configuration has to go at the TOP of the .htaccess file. That never occurred to me and no one ever mentioned it. Thanks for marking this as duplicate, even though, the link given as a duplicate mentions NOTHING about that. – Carnivoris Sep 19 '13 at 16:19

1 Answers1

0

enable rewite-log with loglevel of at least 4, and check, what happend during rewrite. check your access-log too with tail -f to see your request. after this you should be able to analyze better.

your rewrite-rules seems ok for the redirects.

  • I've enabled rewrite-log at level 4 and see nothing in the logfile. It didn't even generate a logfile on its own, I created one and nothing was written to it. I don't see anything in either the access_log or error_log, either. – Carnivoris Sep 18 '13 at 01:11