WordPress.org

Make WordPress Core

Opened 15 years ago

Closed 14 years ago

#4018 closed defect (bug) (fixed)

wp-rewrite/save_mod_rewrite_rules doesn't clean up after itself

Reported by: m0n5t3r Owned by: westi
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.1.2
Component: Administration Keywords: has-patch commit
Focuses: Cc:

Description

when going back to the default URL scheme after using some sort of mod_rewrite permalinks, permalink_structure is emptied, everything works as expected;

however, the rewrite rules are not cleared from .htaccess, since save_mod_rewrite_rules relies on permalink_structure being not empty and will abort silently, causing all non-existent locations to be redirected to Wordpress, which may or may not be what the user wants (supposedly if they don't want mod_rewrite permalinks they'll also rely on the server to handle 404, etc)

The fix is a one-liner actually :)

Attachments (2)

save_mod_rewrite_rules-fix.diff (546 bytes) - added by m0n5t3r 15 years ago.
fix for save_mod_rewrite_rules
4018.diff (1.5 KB) - added by westi 14 years ago.
New version of save_mod_rewrite_rules

Download all attachments as: .zip

Change History (6)

@m0n5t3r
15 years ago

fix for save_mod_rewrite_rules

#1 @westi
14 years ago

  • Owner changed from anonymous to westi
  • Status changed from new to assigned

-1 to this fix.

We need to make the behaviour of save_mod_rewrite rules more obvious.

I'm attaching a new patch which makes the behaviour more explicit and adds some documentation.

Please test.

@westi
14 years ago

New version of save_mod_rewrite_rules

#2 follow-up: @m0n5t3r
14 years ago

works here as expected (trunk, r5795), but gathering everything in a gigantic expression doesn't really help readability

+0

#3 in reply to: ↑ 2 @westi
14 years ago

  • Keywords commit added

Replying to m0n5t3r:

works here as expected (trunk, r5795), but gathering everything in a gigantic expression doesn't really help readability

The point behind merging the current checks into the "gigantic expression" and including the comment on how the function works and what exactly we are trying to achieve and improve the maintainability of the code.

#4 @westi
14 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [5809]) Update .htaccess file when rewrite rules are deleted if it exists.
Fixes #4018

Note: See TracTickets for help on using tickets.