tips and tricks for web developers & designers, and system & network admins

not-sexy.com

how to use parked domains as addon domains

March 8, 2007 | work, apache, linux, htaccess, mod_rewrite | 1:13 pm | Comments [0] |

For those not familiar with the terminology:

- http://en.wikipedia.org/wiki/Domain_parking

Many web hosts limit the number of additional domains you can have on an account, however they usually allow you to park any domain you want, regardless of the addon domains limit. Simply place this code in your .htaccess file, and you will be able to use any parked domain exactly like an addon domain.

RewriteCond %{HTTP_HOST} ^www\.vhost\.com$
RewriteRule ^/$ /vhost/$1 [L]

Happy Webmastering :)


blocking evil bots from your website

It occurred to me recently that search engines are not the only web-bots crawling the intrawebs these days. A fair chunk of web traffic is spam bots trolling your website, looking for email addresses to send coupons for cheap viagra and scantily clad ladies of negotiable virtue. Obviously we want to stop these bots from gaining access to our sites, for 2 reasons:

  1. They are wasting bandwidth that could be better used for legitimate visitors.
  2. So our email addresses end up on less spam lists.

But that is not the end of our worries. There are many “Offline Downloader” type programs, usually used to steal images and content from legitimate websites. Most of these bots do not respect the robots.txt as they should, so I class them as malformed or illegal automated scripts. They chew through our bandwidth and steal our content for their own nefarious uses.

My solution is to block these evil bots by using mod_rewrite in my local .htaccess file. The bots can usually be identified by a their HTTP_USER_AGENT, although they usually have the ability to change the User Agent to a user-specified one to avoid scripts such as these, so a vigilant admin would have to keep a close eye on his log files for suspect bots and continually update his rules.

(more…)