Howdy, I have to perform the following:

  • allow use of from (connecting for an resource)
  • prevent use of* (Return a 404 page when user hits subdomain directly

Is possible using htaccess and, if that's the case, any pointers regarding how to do it?


Using .htaccess you might like to lookup htaccess and regex lessons because they are a big help.

Stop sites from hotlinking is exactly what I suppose you're mentioning to therefore: you have to enable mod_rewrite and add this towards the .htaccess file within the domain's root directory (after some of the items you learn):

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?domain\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png)$

This will point you within the right direction towards how to get it done.