[wp-trac] [WordPress Trac] #47466: Add a comment to .htaccess markers, labelling inserted strings as read-only/ dynamic
WordPress Trac
noreply at wordpress.org
Thu Jun 27 22:55:55 UTC 2019
#47466: Add a comment to .htaccess markers, labelling inserted strings as read-
only/ dynamic
-----------------------------------------------+---------------------------
Reporter: bradleyt | Owner:
| SergeyBiryukov
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 5.3
Component: Rewrite Rules | Version:
Severity: minor | Resolution:
Keywords: has-patch needs-unit-tests commit | Focuses: docs
-----------------------------------------------+---------------------------
Changes (by SergeyBiryukov):
* keywords: has-patch needs-unit-tests => has-patch needs-unit-tests
commit
Comment:
Thanks for the patch @bradleyt, it's a great start.
> Given that the .htaccess file directives are server-side and specified
in English I've intentionally not passed these instructions through `__()`
With over 50% of WordPress installations using a non-English locale, I
think these instructions should be translatable, otherwise they don't
provide any benefit to the user who does not understand them.
While testing the patch, I realized that
[https://developer.wordpress.org/reference/functions/extract_from_markers/
extract_from_markers()] needs to skip these instructions. Otherwise, if
`.htaccess` is not writable, [source:tags/5.2.2/src/wp-admin/options-
permalink.php?marks=91-94#L87 options-permalink.php] would always have a
mismatch between the generated rewrite rules and the ones read from the
file, and display the "You should update your `.htaccess` now" message.
[attachment:"47466.2.diff"] is an updated patch, with the above
considerations in mind.
Before:
{{{
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /src/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /src/index.php [L]
</IfModule>
# END WordPress
}}}
After:
{{{
# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified through WordPress
filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /src/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /src/index.php [L]
</IfModule>
# END WordPress
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47466#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list