How does it work?
Very easy: simply add a media tag in your extension’s manifest file.
Inside your installable package, you should now have the folders /site and /media. During the extension’s installation, the files from /media will be copied to /media/com_mycomp (or plg_myplugin or mod_mymodule).
Separating publicly accessible assets from the rest of the system like this has some security advantages. Ideally, you’d move all other files below the document root, increasing security. Joomla doesn’t support this yet. What you can do however, is add a htaccess file in /com_mycomp with ‘deny from all‘. This way you don’t need to litter your component with index.html files and defined(‘_JEXEC’) or die(); statements. Of course, this assumes that the end user’s host has AllowOverride turned on.Read more