Apache .htaccess recipes, tips and tricks
Posted November 19th, 2010 in Apache (Updated November 24th, 2010)
This is a summary post containing a list of the articles from this blog containing recipes, tips and tricks for using Apache's .htaccess files.
Password protection
- password protecting a directory
- password protection, but allowing access from a specific IP address
- remove password protection from a subdirectory or file
- password protect a hotlinked file
IP address restriction
PHP
- disable PHP in a directory
- disable PHP short tags
- parse .html files as PHP
- set PHP configuration options
Posts using mod_rewrite
- aliasing images to a remote server
- redirecting an existing RSS feed to Feedburner
- using mod_rewrite with vhosts enabled
Other stuff
- setting 503 "Service Temporarily Unavailable" headers
- using mod_expires to control browser caching
- compressing files with mod_deflate
Changing the .htaccess filename to something else
It's possible to change the filename used for htaccess files to something else, although you will need access to the server configuration to be able to set this in either the main config or on a virtualhost by virtualhost basis. It can be useful for having a different .htaccess file for your local development box. Read the post changing the .htaccess filename in Apache for more details.
Offsite articles with more htaccess tips and tricks
I've only got one at the moment, but if I find any other useful ones I'll add them here.
- 17 useful htaccess tricks and tips at queness.com

Comments
blog comments powered by Disqus