#21372 closed defect (bug) (duplicate)
flush_rewrite_rules() completely overwrites .htaccess
Reported by: | rulatir | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | major | Version: | |
Component: | Rewrite Rules | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
A call to flush_rewrite_rules(true) does a very unexpected and potentially destructive thing: it completely overwrites .htaccess.
While this probably isn't stated outright anywhere in the docs, the presence of the BEGIN/END delimiters yields a strong impression that it is safe to add directives to .htaccess outside the delimited Wordpress section.
If overwriting the whole .htaccess is by design and not a bug, then the format of generated .htaccess should be changed. Instead of the BEGIN/END comments misleading the developer into thinking that directives outside of that section will be preserved, it should contain an EXPLICIT STERN WARNING that the file is auto-generated and all changes made to it will be lost.
Change History (4)
Note: See
TracTickets for help on using
tickets.
I can't reproduce the complete overwrite. The rules I've added manually outside of the WordPress section are still there after
flush_rewrite_rules( true )
.Could you provide the steps to reproduce the issue on a clean install?