Force HTTPS with htaccess

Permalink
I need to force specific pages to use SSL which I've done using mod_rewrite in .htaccess:

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^my_dir(.*)$ http://%{HTTP_HOST}/my_dir$1 [R=301,L]

I'm having trouble switching back to non-SSL when moving out of the my_dir folder. Something like this should work:

#RewriteCond %{SERVER_PORT} ^443$
#RewriteCond %{THE_REQUEST} !my_dir
#RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

But it doesn't. Can anyone provide any guidance to get this working?

I've also had to set define('REDIRECT_TO_BASE_URL', false) in site.php to prevent redirect loops but I'm not sure what the implications of this might be. Could this break anything?

Thanks
Joe
jawbonelid
View Replies:
kino replied on at Permalink Reply
kino
It is also possible without using mod_rewrite.
jawbonelid replied on at Permalink Reply
jawbonelid
Can you expand on that a little? ;)
kino replied on at Permalink Reply
kino
I registered in the marketplace has become possible to add it.

http://www.concrete5.org/marketplace/addons/kinos-image-menu/...

However, concrete5 Ver5.4 has been published earlier. So the add-ons may be published later.
What you need in a hurry?
jbx replied on at Permalink Reply
jbx
Resurecting an old thread here, but if you still need to do this, I now have a free addon in the marketplace which allows you to select any pages you like to become https. All other pages will switch back to http.

Hope that helps,

Jon