The configuration community:
Search the Site:

Basic htaccess file

Description

A very simple htaccess file that demonstrates some of the options available for htaccess.

Configuration file

Download file

Options +ExecCGI -Indexes
DirectoryIndex index.html index.htm index.php

ServerSignature Off
DefaultLanguage en-US
AddDefaultCharset UTF-8

AddType image/x-icon .ico

# Error Documents
ErrorDocument 404 /error404.html
ErrorDocument 400 /error400.html
ErrorDocument 401 /error401.html
ErrorDocument 403 "Forbidden!"
ErrorDocument 405 /error405.html
ErrorDocument 406 /error406.html
ErrorDocument 409 /error409.html
ErrorDocument 500 /error500.html

#AddHandler cgi-script .cgi

#Redirects
RewriteEngine On
RewriteBase /

#Treat Hotlinks
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(subdomain\.)?domain.com/.*$ [NC]
RewriteRule ^.*\.(bmp|gif|jpg|jpeg|jpe|png)$ - [F]

#Deny bad request methods
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK|OPTIONS|HEAD)$ [NC]
RewriteRule ^.*$ - [F]

#Basic Authentication
AuthType basic
AuthName "Please enter username and password"
AuthUserFile /.htpasswd
Require valid-user

Vote Result
+++++++++-
Score: 9.0, Votes: 2
Site5 $5 Hosting Deal