Forum Moderators: phranque
New to this forum, found a solution to another forum here but I have another one I though I would post.
What code in .htaccess would I change so when we go to a directory in our website, like [thisdomain.com...] you will be forced into SSL? This site has a valid SSL cert and can be reached via https://
Thanks for the help in advance.
Jim
RewriteEngine On
RewriteCond %{SERVER_PORT}!443
RewriteRule ^(.*)$ [mywebsite.com...] [R,L]
But what I'd really like to do is make a certain file within the directory force SSL, and not the whole directory.
i.e.: [mywebsite.com...]
If I use that website in the above code, the whole directory still gets https along with the .php page, how do I make it so just the .php form is ssl?
In this case, your ".*" pattern is non-specific, and will accept any requested URL in that directory, so all URLs will be redirected. All you have to do is to make the pattern specific to the registration.php URL-path, and include that path in the substitution as well:
RewriteEngine on
RewriteCond %{SERVER_PORT} !443
RewriteRule ^registration\.php$ https://mywebsite.com/directory/registration.php [R=301,L]