Hello all,
Could someone please tell me what I need in an htaccess file to do the following:
On an Apache server, I have sub-folder-A :
www.mydomain.com/folder/sub-folder-A
in which there are a bunch of PDF files
www.mydomain.com/folder/sub-folder-A/pdf_1.pdf
www.mydomain.com/folder/sub-folder-A/pdf_2.pdf
..etc..
and an index shtml page that provides links to all the pdf files.
www.mydomain.com/folder/sub-folder-A/index.shtml
I want to restrict access and redirect so that acessing any file in sub-folder-A from any link on any page of mydomain.com, (including the links on www.mydomain.com/folder/sub-folder-A/index.shtml), causes a redirect to
www.myotherdomain.com/cgi-bin/myscript.pl
myscript.pl will do some logging, record the url that was requested, then redirect the user back to the requested url (so accessing the file from myscript.pl must NOT result in a redirect)
Trying to access any file in sub-folder-A by any other route defaults to "Forbidden".
Thanks.
Example...
RewriteEngine on
RewriteCond %{REQUEST_URI} ^http://www\.mydomain\.com/folder/sub-folder-A/ [NC]
RewriteMap log prg:/path/to/cgi-script/my
RewriteRule ^.*$ /denied.html [F]