Вопрос

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),

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top