Using .htaccess instead for the task
Take a look at the below code, which is all that's needed to accomplish the task using .htaccess:
Notice "js" in the last line, which adds .js files, along with .gif and .jpg to the type of files only the domains listed above can access. The code should be saved inside your .htaccess file, and dropped into your web page directory.
- Tutorial introduction
- Using .htaccess instead for the task