TonyKR wrote:
Requests from Server (Local) machine can access all files in any subfolder.... I forgot to mention previously that some files can be streamed via a Flash player
Ok the important thing to know is how is whatever accessing the files? using fopen? fsockopen? curl? For the flash player: Is it real streaming using fopen type functions or is the flash player making a HTTP request for the files?
TonyKR wrote:
Requests from a Client machine can access just the index.php file in each subfolder....
But how do I get the above to work with particular file types and requests from all non-local IP addresses!
Ok this code can go in your /.htaccess file. It will deny all requests for any file in a subfolder. However, it will allow all requests for index.php in any folder and it will allow all requests made by a local IP addr (ip address starting with 208.113.183). So this should work for everything except I don't know about the flash player access yet.
Code:
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+)/.*\ HTTP [NC]
RewriteCond %{REQUEST_FILENAME} !^.+index\.php$ [NC]
RewriteCond %{REMOTE_HOST} !^208\.113\.183.+$
RewriteRule .* - [F,L]
Check out this
setenvif guide.
Also you may want to add
Code:
RewriteCond %{ENV:REDIRECT_STATUS} !200
before the rewriterule, depending on your server, see
REDIRECT_STATUS variable article (lets local/internal requests through)