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 6212625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:32:59+00:00 2026-05-24T06:32:59+00:00

I need to allow direct access on a specific folder name (and subcontents) via

  • 0

I need to allow direct access on a specific folder name (and subcontents) via .htaccess, and deny all other.

To start, my current .htaccess is:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . index.php [L]

My file structure is, for instance:

    modules/
        core/
            _test/
            publics/
                file.txt
        other/
            _whatever/
                publics/
                    more.txt
            publics/
                sub/
                    file.txt
                other.txt
    .htaccess

I could not access anything, except by files and folders that are in publics folder. On this example, I could access, without problem:

  • modules/core/publics/ [dir]
  • modules/core/publics/file.txt
  • modules/other/_whatever/publics/ [dir]
  • modules/other/_whatever/publics/more.txt
  • modules/other/publics/ [dir]
  • modules/other/publics/sub/ [dir]
  • modules/other/publics/sub/file.txt
  • modules/other/publics/other.txt

I could not have access to any file or folder.

I guess that we will need regular expression, but I don’t know how I can use this on mod_rewrite to works like I want.

Some suggestion?

  • 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-05-24T06:33:00+00:00Added an answer on May 24, 2026 at 6:33 am

    A slight modification to your current htaccess. Any access not under a publics folder will be redirected to index.php:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !publics/
    RewriteRule . index.php [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey. I need to prevent direct access to http://www.site.com/wp-content/uploads/folder/something.pdf through the browser. However the
I need to allow other Python applications to register callback functions for events in
How can you deny direct access to files in a directory where I do
I need to allow the vertical scrollbar in a multiselect listbox (VB6) however, when
I need to allow full-text searching on two fields that are concatenated together. In
I have a need to allow for a user to download an event that
What do I need to allow Visual Studio 2005 to add WCF service reference
Well behaved windows programs need to allow users to save their work when they
Need a way to allow sorting except for last item with in a list.
I need a way to allow each letter of a word to rotate through

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.