Skip to content

Instantly share code, notes, and snippets.

@benpturner
Last active August 1, 2017 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benpturner/830600cf8a1ce6778a87d13d9456203f to your computer and use it in GitHub Desktop.
Save benpturner/830600cf8a1ce6778a87d13d9456203f to your computer and use it in GitHub Desktop.
Apache Rewrite Whitelist
# whitelist need to be formatted like so
# 104.44.44.44 -
# 104.33.33.33 -
RewriteMap ips txt:/opt/whitelist.txt
RewriteCond ${ips:%%{REMOTE_ADDR}|NOTFOUND} !NOTFOUND
RewriteCond %%{HTTP_USER_AGENT} "Mozilla\/5\.0 \(Windows NT 6\.1; WOW64\) AppleWebKit\/537\.36 \(KHTML, like Gecko\)" [NC]
RewriteRule ^/news/(.*) https://yourc2server.com/news/$1 [NC,P]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment