Skip to content

Instantly share code, notes, and snippets.

@yzguy
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save yzguy/c6bb3e9ced54ae50f03e to your computer and use it in GitHub Desktop.

Select an option

Save yzguy/c6bb3e9ced54ae50f03e to your computer and use it in GitHub Desktop.
<VirtualHost *:80>
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>
HTTP to HTTPS redirect in apache, requires mod_ssl and mod_rewrite
Goes in httpd.conf (CentOS, RHEL) or sites-enabled/{site} file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment