Make WordPress Core

Opened 4 years ago

Last modified 9 months ago

#19896 new defect (bug)

Non-WP rewrites not saved on a multisite install

Reported by: johnbillion Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.0
Component: Rewrite Rules Keywords:
Focuses: multisite Cc:


The following code adds a rewrite rule which is classed as a non-WP rewrite rule because its redirect doesn't begin with index.php, and is stored in the non_wp_rules member variable of the WP_Rewrite class.

function my_rewrite() {
	add_rewrite_rule( 'login/?$', 'wp-login.php', 'top' );
add_action( 'init', 'my_rewrite' );

On a single site install, this rewrite rule gets saved directly to the .htaccess file rather than being added to WordPress' internal rewrite array.

On a multisite install, this doesn't happen and the rewrite rule has no effect (probably because once a site is multisite-d WordPress no longer writes to .htaccess). The rule has to be manually added to .htaccess.

Likely introduced in 3.0, reproduced in 3.3 and trunk.

Change History (5)

#1 @topdownjimmy
21 months ago

Confirmed -- I believe I'm encountering this bug myself. (3.5.1)

#2 @adbox
19 months ago

Believing we are encountering this as well.

#3 @joeyblake
11 months ago

We are having this issue as well, non_wp_rewrites are being added to the non_wp_rules property, but never being added to the wp_rewrite->rules property. This is happening in VIP Quickstart (4.2).

#4 @jeremyfelt
10 months ago

  • Focuses multisite added

#5 @idmontie
9 months ago

Still reproducible. Happens only in multisite since the htaccess file is never written to.

Note: See TracTickets for help on using tickets.