Apache Access Basic Settings

Source: Internet
Author: User

1. Disable access to one or more folders

Write inside the. htaccess file

Rewriterule ^foldername-[f,l] #禁止访问某个文件夹

Rewriterule ^ (fname1|fname2)-[f,l] #禁止访问多个文件夹

Change the foldername to the actual folder name.

2, prohibit one or more folders to execute PHP

write inside the. htacess file

Rewriterule uploads/(. *). (PHP) $–[f] #禁止uplolads文件夹执行PHP Other resources can access the read

Rewriterule (UPLOADS|UPLOADS1|UPLOADS2)/(. *). (PHP) $–[f] # Disallow multiple folders to execute PHP notation

3. Prohibit access to a file type    

<files ~ "\.inc$" > #把其中的inc替换成需要的后缀即可
Order Allow,deny
Deny from all
</Files>

Prohibit by file matching, such as prohibiting all access to images:
<filesmatch. (? i:gif|jpe?g|png) $>
Order Allow,deny
Deny from all
</FilesMatch>

Apache Access Basic Settings

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.