I would like to make sure that certain URLs on my site are always accessible via HTTPS, and all other URLs are accessible via HTTP.
I can get any case working in my .htaccess file, however, if I include both, then I get endless redirects.
My .htaccess file:
<IfModule mod_expires.c>
ExpiresActive off
</IfModule>
Options +FollowSymLinks
AddHandler application/x-httpd-php .csv
RewriteEngine On
RewriteRule ^/?registration(.*)$ /register$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (login|register|account)
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(login|register|account)
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule \.(gif|jpg|jpeg|jpe|png|ico|css|js)$ - [S=1]
RewriteCond %{REQUEST_URI} !\.(exe|css|js|jpe?g|gif|png|pdf|doc|txt|rtf|xls|swf|htc|ico)$ [NC]
RewriteCond %{REQUEST_URI} !^(/js.*)$
RewriteRule ^(.*)$ index.php [NC,L]
Does anyone have any suggestions on how I can get the login, registration and account pages to be https without forcing every other page to not be?
source
share