Skip to content

Instantly share code, notes, and snippets.

@mayurah
Last active August 29, 2015 14:10
Show Gist options
  • Save mayurah/0e74cd12fd544cd556c4 to your computer and use it in GitHub Desktop.
Save mayurah/0e74cd12fd544cd556c4 to your computer and use it in GitHub Desktop.
Apache httpd directives / .htaccess / httpd.conf
RewriteEngine On
# IP Canonicalization
RewriteCond %{HTTP_HOST} ^123\.123\.123\.222
RewriteRule (.*) http://www.onezero.com/$1 [R=301,L]
# Libwww-perl Access Test
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* - [F,L]
# Redirect non-www requests to www
RewriteCond %{HTTP_HOST} !^www.onezero.com$ [NC]
RewriteRule ^(.*)$ http://www.onezero.com/$1 [L,R=301]
# For BasicAuth -- http://www.htpasswdgenerator.net/#results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment