Skip to content

Instantly share code, notes, and snippets.

@opnchaudhary
Created January 21, 2014 12:05
Show Gist options
  • Save opnchaudhary/8538822 to your computer and use it in GitHub Desktop.
Save opnchaudhary/8538822 to your computer and use it in GitHub Desktop.
Apache configuration to force all HTTP to HTTPS request
#File: /etc/httpd/conf.d/https_redirection.conf
#Force all HTTP request to HTTPS request
<IfModule !mod_rewrite.c>
LoadModule rewrite_module /usr/lib/apache2-prefork/mod_rewrite.so
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment