Add www subdomain automatically to your domain with htaccess

Posted by on Aug 9, 2010 in Apache | No Comments

Sometimes we need to add the www to our domain automatically, maybe for aesthetics or ajax issues across subdomains. Apache .htaccess is our friend here. You just need to add this to your existing .htaccess file or just make a new one with the following contents:

Prevent image hotlinking with Apache and htaccess

Posted by on Aug 9, 2010 in Apache | No Comments

Question of the million dollars. Those annoying image hot-linkers, eating our bandwidth, our food, our… nevermind. Anyway, if you want to give them hell and stop this behaviour, add the following to your .htaccess file (remember to edit your domain name): Bonus!: In the third line, you can optionally write your server IP for an […]

Prevent directory listing in Apache with htaccess

Posted by on Aug 9, 2010 in Apache | No Comments

Piece of cake. If you need to prevent your files, images or anything else to be listed in those directories where an index file is not present, just add the following to your .htaccess file: Piece of cake.