- Code: Select all
SSLOptions +StrictRequire
SSLRequireSSL
SSLRequire %{HTTP_HOST} eq "google.com"
ErrorDocument 403 https://google.com
NOTE: This code fixes the issue of having to type in the username and password twice. (more info about this)
This will check to make sure that the connection IS using SSL, or it will fail.
It will also check to make sure that the HOST is tirmassagestone.com or it will fail
If it fails, it will issue a 403 "Forbidden" which will redirect to https://google.com
NOTE:There is a more thorough article at [url=http://www.askapache.com/htaccess/apache-ssl-in-htaccess-examples.html]AskApache.com
[/url]
Redirect everything attached to port 80:
- Code: Select all
RewriteCond "%{SERVER_PORT}" "^80$"
RewriteRule "^(.*)$" "https://%{SERVER_NAME}$1" [R=301,L]
Redirect particular URLs to a secure version:
- Code: Select all
RewriteRule "^/normal/secure(/.*)" "https://%{HTTP_HOST}$1" [R=301,L]
Check to see whether the HTTPS environment variable is set:
- Code: Select all
RewriteCond %{HTTPS} !=on
RewriteRule "^(/secure/.*)" "https://%{HTTP_HOST}$1" [R=301,L]
Use the Redirect directive to cause a URL to be served as HTTPS:
- Code: Select all
Redirect / https://google.com/
Changing the scheme (SSL/noSSL) using relative URLs:
- Code: Select all
RewriteEngine on
RewriteRule ^/(.*):SSL$ https://%{SERVER_NAME}/$1 [R,L]
RewriteRule ^/(.*):NOSSL$ http://%{SERVER_NAME}/$1 [R,L]
This lets you use hyperlinks of the form document.html:SSL