htaccess Cheatsheet - Best Blogs Asia
A guide on how to use the Htaccess file effectively for redirection and site controls.
A htaccess file is useful since it can block certain items being viewed, change filenames and urls to make them more SEO friendly and redirect websites. It’s something every webmaster needs to add to their site in order to gain maximum efficiency.
Htaccess Guide
Enable Directory Browsing
Options +Indexes
## block a few types of files from showing
IndexIgnore *.wmv *.mp3 *.avi
Disable Directory Browsing
Options All -Indexes
Customize Error Messages
ErrorDocument 403 /forbidden.html
ErrorDocument 404 /notfound.html
ErrorDocument 500 /servererror.html
Get SSI working with HTML/SHTML
AddType text/html .html
AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml
# AddHandler server-parsed .htm
Redirect Visitors to New Page/Directory
Redirect oldpage.html http://www.domainname.com/newpage.html
Block Hot Linking/Bandwidth hogging
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]
RewriteRule \.(gif|jpg)$ http://www.mydomain.com/image.gif [R,L]
Avoid the 500 Error
# Avoid 500 error by passing charset AddDefaultCharset utf-8
No related posts.
Trackbacks
- htaccess Cheatsheet | Malaysia Guides - Your Digital Guides
- 16 Cheat Sheets on 16 Essential Topics for Web Designers | Pro Blog Design
- 16 Cheat Sheets on 16 Essential Topics for Web Designers | huibit05.com
- 16 tablic dla web designera | Lamiani Project
- Reference Guides and Cheat Sheets | Ts1Design
- 16 Cheat Sheets on 16 Essential Topics for Web Designers
- 16 Cheat Sheets on 16 Essential Topics for Web Designers » -!-PHONEXSIA-!-
Leave a Reply to "htaccess Cheatsheet"
Copyright 2008 - 2013 | Best Blogs Asia




9 Replies:
Hey thanks for the cheatsheet, may be worth puttng together a printable (PDF?) version?
Good idea, could anyone help?