Server-Apache There is no way to limit the number of directories in a project PHP files can be accessed, other PHP files cannot be accessed.

Source: Internet
Author: User
Tags 403 forbidden error
Apache has no way to limit the number of directories in a project PHP files can be accessed, other PHP files cannot be accessed.

The problem seems simple, but I can't find a way to break my head.

I've been searching for Google or something. Solving.

Reply content:

Apache has no way to limit the number of directories in a project PHP files can be accessed, other PHP files cannot be accessed.

The problem seems simple, but I can't find a way to break my head.

I've been searching for Google or something. Solving.

What do you mean by "can be accessed", can the browser be accessed via HTTP?

For example, www/html, Www/pub, www/private three directories, only http://test.com/html, http://test.com/pub can access, Access http://test.com/ Private times 403 Forbidden error.

If this is the demand, Apache can do it:


  
   
    
       Order Deny,Allow    Deny from all
  
   

For details, see: http://httpd.apache.org/docs/current/mod/mod_access_compat.html

After Apache is installed, there is an example configuration in the httpd.conf that comes with it.

If you say that the access refers to "PHP include", such as www/index.php, can include www/html, www/pub two directory files, but include www/private under the file, reported permission Denied, then you just set the Www/private permissions to 766, and let the Apache process owner is not the owner of the Www/private directory

The simplest solution to change the directory structure ... Get those files in the same directory

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.