Opened 17 months ago
#19896 new defect (bug)
Non-WP rewrites not saved on a multisite install
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Rewrite Rules | Version: | 3.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
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.