Tested and working with this .htaccess file:
code:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?whois\.mydomain\.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z0-9.-]+\.[a-z]{2,4})$ /whois.php?d=$1 [L,NC]
The second RewriteCond prevents an infinite loop (because the domain regex matches "whois.php"), and the [NC] flag is used instead of the 'i' modifier.