I have an existing .htaccess file with redirects for forcing "www" and removing index.php from the URLs (it's an Expression Engine site). There's also a redirect for the IP to the URL. Now, I need to force the site to use HTTPS. No matter where I place the redirect, when I try to access the site, I get a redirect/loop error. Any help would be appreciated. Here's what I currently have:
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Force WWW
RewriteCond %{HTTP_HOST} ^domain\.org$ [NC]
RewriteRule ^(.*)$ http://www.domain.org/$1 [R=301,L]
# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/cp/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
# Rewrite and direct IP address to URL
RewriteCond %{HTTP_HOST} ^XXX\.XXX\.XXX\.XX
RewriteRule (.*) http://www.domain.org/$1 [R=301,L]
</IfModule>
And I need to place either this:
Code:
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
Or this:
Code:
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Thank you for your help!