Skip to content

Instantly share code, notes, and snippets.

@juji
Created June 18, 2014 03:16
Show Gist options
  • Save juji/a419eb24b8b9dbf68433 to your computer and use it in GitHub Desktop.
Save juji/a419eb24b8b9dbf68433 to your computer and use it in GitHub Desktop.
Apache common .htaccess
Options -Indexes
Options +FollowSymLinks
IndexOptions +Charset=UTF-8
RewriteEngine On
# forced domain
RewriteCond %{HTTP_HOST} !=paragon.local
RewriteRule ^.*$ paragon.local%{REQUEST_URI} [R,L]
# Hotlink prevention
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://paragon\.local [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://admin\.paragon\.local [NC]
RewriteRule \.(jpg|jpeg|png|gif|css|js|ttf|woff|eot|otf|svg|htc)$ http://goo.gl/9iEL6d [NC,R,L]
# redirect all 404 to index
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule .* index.php [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment