Forum Moderators: phranque
The scenario is a main page with the a login requiring SSL, but most of the other pages don't require SSL. Since the entry to the main page can be domain.com, or www.domain.com, or domain.com.index.html, it provided some unique challenges (or maybe I made it harder than it had to be. :-) )
RewriteEngine On
RewriteCond %{SERVER_PORT}!^443$
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule (.*)? [example.com...] [R=301,L]
(space before the!)
Of course, if any sub directory is called this will also direct to https - in this case there is no such requirement. I'm sure there are better approaches. :-)
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(index\.html)?$ https://example.com/$1 [R=301,L]
I assumed a .html extension on the actual index page -- Modify the file extension as required.
Jim
It seemed like this
^(index\.html)?$
Meaning "zero or more of the previous" would cause it to break when you would request, say, example.com/about.html. It would then go to the secure version of the main page for *any* link.
I will look again, it's entirely possible I had something else going wrong that was breaking it.