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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:59:23+00:00 2026-05-19T23:59:23+00:00

So, Apache’s default directory listing sucks and mod_autoindex’s customisation options suck, so I figured

  • 0

So, Apache’s default directory listing sucks and mod_autoindex’s customisation options suck, so I figured I could write some rewrite rules in my server root to redirect any requests to a directory:

<IfModule rewrite_module>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} -d
    RewriteRule .* /index.php?dir=$0
</IfModule>

Now, I get the impression this works at least a little, as turning off indexes still leaves localhost accessible (it displays the index.php), however it doesn’t seem to reach subdirectories (which either revert to Apache’s directory indexes if the indexes option is on, or give a 403 if they’re off).

My question is: can I get this rule to apply globally or is my quest for pretty directory indexes doomed to failure?

Edit: I should note: the above rules are contained in a .htaccess in the server root.

Edit: Ideally the solution, if it exists, would still have DirectoryIndex functionality (that is, index.php etc. will be displayed if it exists),

  • 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-19T23:59:23+00:00Added an answer on May 19, 2026 at 11:59 pm

    The -d directory test does only work with absolute file system paths. So either provide an absolute file system path (e.g. by using %{DOCUMENT_ROOT}%{REQUEST_URI} or %{REQUEST_FILENAME} directly) or use -D that makes an additional subrequest to resolve the URI path to a file system path. I’d prefer:

    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule .* /index.php?dir=$0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want my apache to register some of my predefined environment so that
Apache just fails to start with NO error message when we try to reboot
Apache XMLBeans can be used to generate Java classes and interfaces from XML Schema
Using Apache's commons-httpclient for Java, what's the best way to add query parameters to
On Apache/PHP sites if I want to put a senstive file within my website
I've used Apache CXF to expose about ten java classes as web services. I've
I have apache 2.2 and tomcat 5.5 running on a Windows XP machine. Which
I've got an Apache server that has one access log file that is topping
The set up for apache-jmeter allows for a URL to be sent to a
My Ubuntu server has Apache and Subversion installed. I use this server as a

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.