Redirect browser to use SSL

You can redirect browser to use SSL secure port using .htaccess file with Rewrite Rules.

Create a .htaccess file with the below Rewrite rule.

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^ https://secure.yourdomain.com%{REQUEST_URI} [NS,R,L]

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
debug rewrite log

If you don't have "NS" (Not for internal Subrequests) in the rewrite rule, it may re-write internally and not pass it the redirect as desired. To debug, turn on rewrite logging via:

  RewriteLog /var/log/httpd/rewrite_log
  RewriteLogLevel 3

Comment