Howto::SSLRedirect

From Computer Science Wiki
Jump to navigation Jump to search

Introduction

CS Hosting uses SSL off loading (handled by the load balancers), so the apache service does not know if the end user is using SSL or not. Standard apache SSL redirection won't work, and will usually lead to an infinite loop.

.htaccess

Add the following the your .htaccess file to make the page automatically redirect to SSL.

  RewriteEngine On
  RewriteCond %{HTTP:X-Forwarded-Proto} !https
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]