Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8361305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:40:04+00:00 2026-06-09T11:40:04+00:00

I want to deny access to multiple PHP files in directory /all/cstl/ . My

  • 0

I want to deny access to multiple PHP files in directory /all/cstl/.

My .htaccess is also stored in this directory.

This is my current code and it’s not working.

<Files "\ (config.php|function.php|include.php)">
  Order allow,deny
  Deny from all
</Files>

I have tried to deny the directory and allow specific files but it denies the directory and does not allow the requested .php files. My code for this is:

<Directory />
    Order deny,allow
    Deny from all
<Directory>

<Files "index.php|post.php">
    Order deny,allow
    Deny from all
</Files>

Please give me some example of blocking access to multiple specific files within a directory.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:40:05+00:00Added an answer on June 9, 2026 at 11:40 am

    There are several problems with the .htaccess you have there.

    As BSen linked in the comment above, you should use FilesMatch.
    Also, your regular expression is wrong.

    The problem with the regular expression is that you have an escaped space at the start, so all files must start with a space character (followed by one of config.php, function.php etc)

    Also a small explaination of the Order allow,deny directive:
    http://www.maxi-pedia.com/Order+allow+deny

    Try this:

    <FilesMatch "config\.php|function\.php|include\.php">
      Order allow,deny
      Deny from all
    </FilesMatch>
    

    If you’d like to deny all but a few files, this would read as

    Order deny,allow
    Deny from all
    <FilesMatch "index\.php|index\.html">
      Allow from all
    </FilesMatch>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can you deny direct access to files in a directory where I do
I have the follow .htaccess inside upload directory: order allow,deny deny from all I
I have a secure site (.htaccess = Deny from all) that I want to
How can I deny access to a file I open with fstream? I want
I have a folder with multiple .aspx pages that I want to restrict access
I am trying to deny access to a sub-domain directory from people accessing directly
I need to deny all access to any controller if they do not login.
I am using Cakephp1.3, i want to deny some functions Here is my code
I want to disable access to any file OR directory, whose name begins with
Is there a possible way to deny Matlab access to all cores? There are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.