Automatic creation of .htaccess files can cause errors

Created on 17 January 2009, about 16 years ago
Updated 13 February 2025, about 2 months ago

Problem/Motivation

Drupal enforces creation of .htaccess files yet some environments don't use them and others create errors when they are present (eg. IIS + WebsitePanel).

Proposed resolution

When Apache is reported as the web server, automatically create .htaccess files. Otherwise, do not create them and warn the user about the possible implications of this. Allow users to explicitly enable or disable the automatic creation of .htaccess files using a config setting (and hence clear any warning message).

Remaining tasks

  • Determine if we should only disable .htaccess auto creation as an option for certain web server platforms (#56)
  • Determine the server platform names ($_SERVER['SERVER_SOFTWARE']) that need to be whitelisted
  • Re-roll patch so it applies to HEAD.

User interface changes

New warning message in File System section of Status Report.

API changes

New config setting.

Original report by kbahey

Check for .htaccess, and creating .htaccess should only be done for Apache

We are currently doing this check for non-Apache servers too, and it causes errors to be displayed when using IIS and other servers.

So, this patch limits this checking and .htaccess creation to Apache only.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component

file system

Created by

πŸ‡¨πŸ‡¦Canada kbahey

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Merge request !11204Resolve #360057 "Automatic creation of" β†’ (Open) created by smustgrave
  • Pipeline finished with Failed
    about 2 months ago
    Total: 150s
    #423442
  • Pipeline finished with Success
    about 2 months ago
    Total: 496s
    #423444
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    So this one is coming as the "One" for bugsmash so thought I'd give it a quick look.

    Took the patch in #82 and only slightly fixed up with today's checks: Constructor promotion, return types, deprecation version.

    #87 I agree and changed that to an error()

    Also tweaked the CR some but it was pretty straight forward.

    Still NW for

    The new setting needs to be added to settings.php with a comment.

Production build 0.71.5 2024