docker-library / docker-library/wordpress

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

Open
#792 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
2k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the image ENTRYPOINT script and compare its handling of /usr/src/wordpress/.htaccess and /var/www/html/.htaccess before and after the initial setup. Trace the WordPress setup path that rewrites the file; done means confirming whether the empty managed block is intentional and identifying the relevant fix or documentation if it is not.

Written by the indexing model from the issue text.

Assessment

Tech stack
apache, php, shell, wordpress
Domain
backend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.