How do I prevent php execution by directory name?

lbeachmike

Well-Known Member
Dec 27, 2001
307
4
318
Long Beach, NY
cPanel Access Level
Root Administrator
Hi there -

I'd like to prevent php execution for any file on all accounts of my servers by directory name.

For example - if the directory name is "cache" or "images" or "uploads" or "downloads" (or any/all subdirectories thereof) I want to disallow php from running in those directories. I realize this can be done at the directory level via .htaccess, but I want to setup global controls.

Is there a way to do this?

Thanks.

Mike
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463
Hello :)

I am not aware of a specific rule to block PHP execution for specific directories by name. However, the following document will be useful if you develop a rule to use in the domain name's VirtualHost entry in the Apache configurationn file:

Custom templates that will apply to all virtual hosts

Thank you.