Redirect To SSL Using Apache’s .htaccess File

# If we have neither mod_ssl nor mod_rewrite
# then let’s simply deny the access:

deny from all

# If we have mod_rewrite
# then let’s redirect to https version of requested page

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

# else (if we have mod_ssl)
# let’s make sure that we require SSL

SSLRequireSSL

# Finally, if anything went wrong, let’s redirect to error page:
ErrorDocument 403 http://syiron.org.kg

Leave a Reply