Make WordPress Core

Opened 20 years ago

Closed 19 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
Priority: normal Milestone: 2.3
Component: Administration Version: 2.1.2
Severity: normal Keywords: has-patch commit
Cc: Focuses:

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 20 years ago.
fix for save_mod_rewrite_rules
4018.diff​ (1.5 KB ) - added by westi 19 years ago.
New version of save_mod_rewrite_rules

Download all attachments as: .zip

Change History (6)

#1 @westi
19 years ago

  • Owner changed from anonymous to westi
  • Status new → 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
19 years ago

New version of save_mod_rewrite_rules

#2 follow-up: @m0n5t3r
19 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
19 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
19 years ago

  • Resolution → fixed
  • Status assigned → closed

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

Note: See TracTickets for help on using tickets.