Forum Moderators: phranque
Obviously, I want to redirect the https requests to http, but only some of them as parts of the site do require SSL.
This is basically what I need...anything that is in a subfolder should be able to be accessed via SSL, any page in the root should only be able to be accessed via standard http connections.
All pages in the root should end in either .htm or .html with filenames made up of letters, numbers, and hyphens.
Will something such as the following work or is there a more streamlined way to handle this?
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^([^/]+)\.html$ http://www.example.com/$1.html [R=301,L]
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^([^/]+)\.htm$ http://www.example.com/$1.htm [R=301,L]
Thanks!
Also, I suspect you'll want to include the "html?" in the back-reference, so that a request for "htm" will stay as "htm" and one for "html" will stay "html":
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^([^/]+\.html?)$ http://www.example.com/$1 [R=301,L]
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(([^/]+/)+.*)$ https://www.example.com/$1 [R=301,L]
Jim