Htaccess DirectoryIndex index.php Not Found 404
Oh that *is* interesting.
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
The condition that is in bold above (which is already in the htaccess), should be doing the trick. But for some reason, it’s not.
The “RewriteCond %{REQUEST_FILENAME} !-d” says, “if the request is not a directory, then use the rewrite rule below”. And so, a request for an existing directory should fall through on this condition.
Another interesting thing to note is that we’ve got cascading htaccess files. One in the parent public_html (drupal’s), and one in the dir1 folder (wp / optimizepress). Cascading mod_rewrites are the best!
Ok, so quick and simple fix?
Ahhhhhhhhhhhhhh…. FOUND IT.
The “RewriteCond %{REQUEST_FILENAME} !-d” was in fact working.
But before that condition in the htaccess, was this:
# Set the default handler. DirectoryIndex index.php
And there’s no index.php in the “/dir1/dir2/” folder. Despite the fact that there is an index.html. Hence, 404.
I’ve commented out that line, and Viola.
http://peacefulmedia.com/dir1/dir2/
~ LD
>
On 6/11/2013 10:35 AM, NG wrote:
> I know you can do it via htaccess:
>
http://css-tricks.com/snippets/htaccess/remove-file-extention-from-urls/
>
> On Tue, Jun 11, 2013 at 10:28 AM, JAM wrote:
>
> Heya PM noggins,
>
> I’m curious as to how this works:
>
>
http://peacefulmedia.com/dir1/dir2/index.html
>
> but not this:
>
>
http://peacefulmedia.com/dir1/dir2 (404)
>
> Any sneaky ways around Drupal’s tentacles?
>
> jam