Greetings All,

Have been wrangling with a solution for the following problem (HTACCESS Rewrites).

PROBLEM: Website uses a single PHP program to serve out all content including a homepage slideshow. My desire is to (1) not impact the ability for the PHP program to access the slideshow images but (2) redirect a user directly accessing the image directory or its contents to the PHP program with a protection output, should they simply look at the HTML and try to access the image dir or files directly.

Not so much concerned about preventing linking from other REFERERS [yet], trying to solve one problem at time and plenty of examples for that floating around.

WARNING: Performing the development on a home XAMPP setup before upload, but using PHPINFO to compare $_SERVER vars to make appropriate adjustments and verifying PHP.INI settings are compatible with that on POWWEB. Tried a couple items direct on the POWWEB website, and getting similar behavior.

It would seem all my attempts thus far accomplish either (1) or (2) but not both. Have tried various forms of HTACCESS at the root and within the IMAGE directory but again, only succeeding at one or the other.

Here is the directory structure of consequence from the DOC_ROOT (/home/larryg/httpd):
/sbcsa/htdocs/
/sbcsa/htdocs/php/
/sbcsa/htdocs/images/ <== slideshow ONLY images (jpg)

Here is the current HTACCESS file at the /sbcsa/htdocs/ directory
Code:
### Redirect
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/sbcsa/htdocs/images(.*)
RewriteCond %{SCRIPT_NAME} !^/sbcsa/htdocs/php/sbcsa.php
RewriteRule .* http://192.168.1.10/sbcsa/htdocs/php/sbcsa.php?topic=protect [R=302,L]
This has an interesting behavior. It unfortunately prevents the slideshow images from appearing, but does redirect the following request
HTML Code:
http://192.168.1.10/sbcsa/htdocs/images
to the
PHP Code:
http://192.168.1.10/sbcsa/htdocs/php/sbcsa.php?topic=protect 
. The twist is while on a page resulting from the PHP file, if you directly access an image with the following
HTML Code:
http://192.168.1.10/sbcsa/htdocs/images/image1.jpg
it will be displayed (not desired) but if you refresh that same request, it will go to the PROTECT page. Figure this is cause at the time you directly type in the image address, the SCRIPT_NAME is still coming in as the PHP file, hence the Rewrite is ignored on the first pass, but not subsequent passes.

In any case, have looked at and researched HTACCESS examples until I am blue in the face literally! Gotta take a break from it, but would welcome any inputs as to if achieving (1) and (2) are possible.

Thanks in advance!

LarryG