Skip to content

.htaccess is emptied during the initial setup - as intended? #792

@czka

Description

@czka

The contents of /usr/src/wordpress/.htaccess in wordpress:latest (6.1.1-php8.0-apache as of writing this) are the following:

$ docker run -ti --entrypoint '' wordpress:latest cat /usr/src/wordpress/.htaccess
# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

During the initial docker run --name wordpress <your options go here> wordpress:latest, the ENTRYPOINT script copies /usr/src/wordpress/.htaccess as it is into /var/www/html/:

$ docker exec wordpress /bin/sh -c "cat /var/www/html/.htaccess"  
# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

After I open my WP page in a browser and complete the initial setup, I notice that all those rewrite settings are now gone:

$ docker exec wordpress /bin/sh -c "cat /var/www/html/.htaccess"
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.

# END WordPress

Is that as intended?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions