Skip to content

Instantly share code, notes, and snippets.

@axooh
Created August 29, 2012 19:20
Show Gist options
  • Save axooh/3517511 to your computer and use it in GitHub Desktop.
Save axooh/3517511 to your computer and use it in GitHub Desktop.
.htaccess Snippets
# Force trailing slashes
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
</IfModule>
# Prevent Hotlink
RewriteEngine On
#Replace ?mysite\.com/ with your blog url
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your "don't hotlink" image url
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]
# Force download of specific file
<Files *.xls>
ForceType application/octet-stream
Header set Content-Disposition attachment
</Files>
# Log PHP Errors in log file
# display no errs to user
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
# log to file
php_flag log_errors on
php_value error_log /location/to/php_error.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment