Opened 22 months ago
Last modified 6 months ago
#6835 reopened defect (bug)
Corrupt code in official documentation
Reported by: | Ov3rfly | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | HelpHub (wordpress.org/documentation) | Keywords: | |
Cc: |
Description
Code in official documentation at wordpress.org is corrupt.
Example: https://wordpress.org/documentation/article/htaccess/
This is confusing when it is necessary to point people with corrupt/lost .htaccess
files to an official source where they can compare and learn the correct content.
Currently shown:
# 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
Expected:
# BEGIN WordPress <IfModule mod_rewrite.c> 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] </IfModule> # END WordPress
In addition to confusion, the missing <IfModule>
lines can also cause fatal error 500 when code is copied to servers without mod_rewrite
in place.
The issue affects all examples on this page and has been reported already a few times during last years via feedback at end of that page, nothing happened.
Maybe a second issue: Is this feedback read by anybody?
Attachments (2)
Change History (7)
#2
@
22 months ago
- Resolution invalid deleted
- Status changed from closed to reopened
WordPress core adds <IfModule>
lines to .htaccess
since version 1.5.0.
https://developer.wordpress.org/reference/classes/wp_rewrite/mod_rewrite_rules/
The official documentation clearly states:
This page may be used to restore a corrupted .htaccess file (e.g. a misbehaving plugin).
This first code block is clearly meant for copy&paste directly into place.
The <IfModule>
lines also have been in documentation since ever.
There is no reason to remove these lines. Empty lines are there now instead.
That leads to conclusion that this code must be corrupt.
#3
@
22 months ago
It is true that the WordPress core code adds them, but it doesn't change the fact that the <IfModule>
lines are really not necessary. If the rewrite module is installed on the server, then the configuration code works regardless of the <IfModule>
lines.
It's possible that they may have been lost over time due to the HTML processing and or some amount of copy/paste from the whatever the original documentation was. And as you said, you can leave feedback on that article. The feedback will be considered if and when the documentation is ever updated. At present, there seems to be no need to update the documentation.
#5
@
6 months ago
As an update: the article in question has been relocated to https://developer.wordpress.org/advanced-administration/server/web-server/httpd/ and is under the purview of the Advanced Administration Handbook. That handbook is managed on GitHub, and the article in question is specifically here.
cc: @javiercasares (the handbook's overseer)
Those are examples. You are intended to learn from them, not to copy/paste them directly into place.
That is the nature of documentation. It contains examples to teach you how the code works. Additionally, mod_rewrite is a requirement (with Apache) for using pretty permalinks in WordPress. The Ifmodule lines are unnecessary.