This may seem rather simple, but there are several web URLs that I need to reroute to an SSL URL. Can this be done with .htaccess? If so, how?
For example, say there’s web page that requires a user to login (that’s already been coded). User logs in, but the URL they are forwarded to that has the sensitive data (downloadable files), needs to be rerouted to the SSL URL.
You can code the redirect to go to the https address in your programming itself. Of course the user can then change the URL and switch to http (nobody would probably do this, but it’s possible), and in that case you can use .htaccess to redirect them back to https.
An example of how you can build such an .htaccess you can find over here http://www.datakoncepts.com/seo in the section “Enforce Secure Server”
I have examples in my signature’s tutorial (near the end) and recommend:
Use RewriteCond %{SERVER_PORT} ^443$ to check that SSL has been requested (because {HTTPS} is either ‘on’ or null). I also recommend that you send non-secure pages to http:// and not let them use the secure server but that wasn’t your question.
Use PHP scripts, not html, and check there, too, that SSL is in use.
RewriteCond %{REQUEST_URI} ^(documents|client-settings)\.html$ (this would be for ‘documents.html’ and ‘client-settings.html’ pages)
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .? https://www.domainname.com/%1.html [R=301,L]
So this would force pages ‘documents.html’ and ‘client-settings.html’ to be on ‘https://’ correct? I’m not sure about the {SERVER_PORT}, but I do know the client has an SSL; so would changing {SERVER_PORT} to {HTTPS} make much difference?
I’ve also noticed that it looks like I will need to do the same thing but for all files within a folder: