Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#21372 closed defect (bug) (duplicate)

flush_rewrite_rules() completely overwrites .htaccess

Reported by: rulatir's profile 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)

#1 @SergeyBiryukov
12 years ago

  • Keywords reporter-feedback added

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?

#2 @SergeyBiryukov
12 years ago

Related/duplicate: #19900

#3 @wonderboymusic
12 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #19900.

#4 @SergeyBiryukov
12 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.