Monday, July 21, 2003

.htaccess

Turn off directory contents listing.

Options -Indexes

Set error pages. The trailing slash is required for directories. The server doesn't like http:// but it will work.

ErrorDocument 400 /directory/
ErrorDocument 401 /directory/file.html
ErrorDocument 403 http://www.domain.com/directory/
ErrorDocument 404 /
ErrorDocument 500 " custom text

Prevent hotlinking in this and in sub directories. Options All negates any higher level Options -Indexes, so if you want that you'll have to do it again after this block. Note that line 3 allows direct requests. Delete it to disallow direct requests.

Options All 
RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^$ 
RewriteCond %{HTTP_REFERER} !^http://(www.)?mydomain.com/.*$ [NC] 
RewriteRule .(gif|jpg|png)$ - [F] 

Password protect this directory and sub directories.

require valid-user
Authname DirectoryName
AuthPAM_Enabled off
Authtype Basic
AuthUserFile /somewhere/.htpasswd
web
{ "loggedin": false, "owner": false, "avatar": "", "render": "nothing", "trackingID": "UA-36983794-1", "description": "", "page": { "blogIds": [ 85 ] }, "domain": "holtstrom.com", "base": "\/michael", "url": "https:\/\/holtstrom.com\/michael\/", "frameworkFiles": "https:\/\/holtstrom.com\/michael\/_framework\/_files.4\/", "commonFiles": "https:\/\/holtstrom.com\/michael\/_common\/_files.3\/", "mediaFiles": "https:\/\/holtstrom.com\/michael\/media\/_files.3\/", "tmdbUrl": "http:\/\/www.themoviedb.org\/", "tmdbPoster": "http:\/\/image.tmdb.org\/t\/p\/w342" }