Forum Moderators: phranque

Message Too Old, No Replies

Stopping access to a folder, but not with code

         

Karma

4:01 pm on Oct 29, 2010 (gmt 0)

10+ Year Member



I have a folder containing cache files that I'd like my code to be able to access, but not the search engines.

I (PHP) include the cache file (E.g widgets.cache) if it is under 2 hours old from a folder called (root)"mycache".

However if I type in "http://www.mydomain.tld/mycache/widgets.cache" I can view the view.

Is there a way of stopping this from happening? Might not even by a .htaccess thing.

Many thanks

jdMorgan

8:46 pm on Oct 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Denying access to the folders in .htaccess (or any server config file) will affect only access by HTTP URL, and have no effect on internal server "file includes." The "ht" in .htaccess refers to "HTTP access."

You can use either mod_rewrite or mod_setenvif and mod_access to do this, as you prefer.

Jim

Karma

2:16 pm on Nov 2, 2010 (gmt 0)

10+ Year Member



Many thanks Jim, had a feeling this might be a stupid question :/

g1smd

3:34 pm on Nov 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not a stupid question at all. It's not an easy concept to grasp sometimes!