Skip to content

Instantly share code, notes, and snippets.

@schnell18
Created March 14, 2014 08:20
Show Gist options
  • Save schnell18/9543938 to your computer and use it in GitHub Desktop.
Save schnell18/9543938 to your computer and use it in GitHub Desktop.
Apache mod_rewrite rule to redirect insecure http request to https
# Redirect insecure http request from outside of internal network to https
RewriteEngine on
RewriteCond %{HTTPS} !^on$ [NC]
RewriteCond %{REMOTE_HOST} !^100\.2\.[0-9]+\.[0-9]+$
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R]
@schnell18
Copy link
Author

Here is a good tutorial on mod_rewrite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment