Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By changing DirectoryIndex index.php
to DirectoryIndex index.php index.html index.htm
in .htaccess, we achieve to:
- Let HTML applications which use these index files work in subdirectories under Drupal
- Give users a clue about what they need to do for applications with a different index file
- Spare ourselves some frequent support questions
Patch attached.
Comment | File | Size | Author |
---|---|---|---|
#13 | 328155_13_dirindex.patch | 533 bytes | mr.baileys |
#12 | dirindex.patch | 374 bytes | cog.rusty |
#10 | dirindex.patch | 385 bytes | c960657 |
#3 | dirindex.patch | 385 bytes | cog.rusty |
dirindex.patch | 378 bytes | cog.rusty | |
Comments
Comment #1
cog.rusty CreditAttribution: cog.rusty commented- And also spare ourselves from many unrelated support nightmares when users start fiddling with URL rewrites to fix their problem.
Comment #3
cog.rusty CreditAttribution: cog.rusty commentedNot sure what the problem is, but here is a second try.
Comment #4
lilou CreditAttribution: lilou commentedComment #6
c960657 CreditAttribution: c960657 commentedI can confirm that this works as advertised. AFAICT it has no performance impact for existing pages, because index.php is always found in the root directory, so Apache doesn't look for index.html or index.htm.
Comment #7
c960657 CreditAttribution: c960657 commentedComment #9
cog.rusty CreditAttribution: cog.rusty commentedI wonder why this patch changed from "passed" to "failed" retroactively after 3 months.
At first glance I don't see what needs to be done. I don't know what "File naming: Pass 4, Fail 1" means. Maybe I'll take a better look some day when I have more time.
Comment #10
c960657 CreditAttribution: c960657 commentedThe test failure is due to #368502: File naming test sometimes fails. I have uploaded the same patch again (AFAIK there is no way to make the testbot pick up a patch that has failed once).
Comment #11
mr.baileysThe patch seems to contain non-Unix line endings (CR+LF instead of LF). I think the guidelines were changed recently to require Unix line endings (not sure if this applies to non-PHP files though):
Comment #12
cog.rusty CreditAttribution: cog.rusty commentedThis page makes me feel tired...
Comment #13
mr.baileysI tried to apply the patch to a clean D7 HEAD install, but it didn't apply cleanly (looks like a one-line offset?)... Not wanting to make cog.rusty even more tired, I re-rolled it :)
I wish I could add the second positive review, but I'm on IIS 7, which ignores the
DirectoryIndex
directive and only imports the URL rewriting rules. For what it's worth, I can confirm that it doesn't choke on this change though...Comment #14
j.somers CreditAttribution: j.somers commentedPatch applied cleanly.
Got the access denied error before the patch, correctly finds my index.html file after I applied the patch.
Comment #15
webchickI've actually totally been bitten by this before too. It never occurred to me to change the DirectoryIndex value.
Committed to HEAD. Thanks!