Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How do I prevent php execution by directory name?

Discussion in 'Security' started by lbeachmike, Sep 22, 2013.

  1. lbeachmike

    lbeachmike Well-Known Member

    Joined:
    Dec 27, 2001
    Messages:
    306
    Likes Received:
    1
    Trophy Points:
    316
    Location:
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice