Forum Moderators: phranque
I hope i can describe this right.
I offer streaming videos. When a person requests a video i create a temporary video file using the users IP address. The temp video name might look like "69.160.79.99.rm" within the directory.
Now, i'd like to use htaccess to block any requests for this file name NOT from the IP that created it.
In other words, the file named above should only be retrievable from the IP address "69.160.79.99".
i was thinking a line in my htaccess file like:
RewriteCond %{THE_REQUEST}!^%{REMOTE_ADDR} [NC]
but this fails to do the trick, i get error messages.
Any ideas?
Thanks,
Paul
Your code won't work because RewriteCond can't accept server variables in the pattern on the right side.
There is a way to do this, I think, relying on a trick that member Andreas_Friedrich came up with as described in this thread on how to rewrite an arbitrary subdomain to a subdirectory [webmasterworld.com]. Take a look at the code where it tests to see if the requested subdirectory is equal to the subdomain. You can adapt that comparison technique to your needs, I believe.
Jim