Page 1 of 1

.htaccess Dir Listing Only Redirect

Posted: Tue Apr 24, 2007 10:04 am
by CoderGoblin
Hello All,

Put simply I want to use redirect only when on the Directory listing to the home page when in a sub-directory where the .htaccess used to be RewriteEngine off and the root directory points everything to a specific php script (Zend Framework setup).

The directory and .htaccess files are as follows

Code: Select all

Root
  .htaccess
  application directory
  public directory
        .htaccess
The root/.htaccess is

Code: Select all

RewriteEngine on
RewriteBase /~user/application
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
Under the public directory with the aid of Google I changed the .htaccess to, rather than just "RewriteEngine off":

Code: Select all

RewriteEngine off
Options -Indexes
I then get a error 500 when trying to view the directory without any file information. What I really want to do is redirect to the index.php at the top level if directory listing but allow any files access if referenced directly. I need to "ignore" any redirects defined in the initial .htaccess.

Hopefully this makes sense and someone has come across the problem/solution before. If they can either give me a solution or point me in the right direction (and I don't mean the apache .htaccess documentation as I have looked at that already and come away more confused than ever 8O ).

Thanks in advance