Forum Moderators: phranque
Your rewrite rule suggests that all traffic which is not sent to the www. version of your domain should be 404-ed.
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$ [NC] if the URLS in question no longer exist they will automatically return 404
Second question, why is the webserver listening to these subdomains? It shouldn't if you have your VirtualHost sections properly setup. This rewrite rule is a fix for something which is caused somewhere else.
if the URLS in question no longer exist they will automatically return 404A 404 can also be returned manually. (Note that the L flag in mod_rewrite isn't needed with non-300-class responses. It will do no harm, it's just not necessary.) In some situations, this will make less work for the server, since it doesn't have to go look whether a specific file exists; at most it just has to glance at a RewriteCond.