Tweak your blog with .htaccess
Today, I’m going to share with you some of my favorite tips on using .htaccess for tweaking your niche sites. In order to use this tutorial, you must have access to .htaccess file from your hosting account. Usually, it’s located in your root directory. If you can’t find the file, create one.
Open .htaccess and let’s get started.
1) How to hide a directory listings without an index file
Many times, for some reason, you may forget to create an index file for each directory. For example, an image directory. Instead of creating index files for each directory, you can hide the directory from being shown by using the following .htaccess code.
Options - Indexes
2) Redirecting http://yourdomain.com to http://www.yourdomain.com
With the following code, you will be able to redirect visitors who come through non-www domain to the www domain.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com [nc]
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
3) Parsing PHP from HTML extension files
Usually by default, you are able to parse PHP code using .php extension, but with the following code, you can parse PHP code using a HTML extension.
AddType application/x-httpd-php .php .html
There are many things you can do with .htaccess, but I’ve shared my favorites only. If you want to learn more about using .htaccess, Google something like “.htaccess tutorial” You will find plenty information from Google.
That’s it for today!

February 5th, 2006 at 4:58 am
Nice tips, Bo, I already knew some uses of .htacces like blocking certain referrers, but these uses are also quite useful.