Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
.htaccess hacks
Well i didn't see any thread about this so let's start one :DRINK:
Specify the Directory Index:
DirectoryIndex newindex.html
Specify 404 error:
ErrorDocument 404 /404error.html
Redirect 301
Redirect 301 /old.html /new.html
Resolve www (make become
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ [nocase]
RewriteRule ^(.*)$1 [last,redirect=301]
Deny access to specific ip (
order allow,deny
deny from
allow from all
Prevent Hot linking
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?*$ [NC]
RewriteRule \.(gif|jpg|css)$ - [F]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.