WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#11995 closed defect (bug) (duplicate)

2.9.1 rc1 url rewrite rules constantly trying to re-add the rules (iis7)

Reported by: wpmuguru Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Multisite Keywords:
Focuses: Cc:

Description

MU Trac Ticket: http://trac.mu.wordpress.org/ticket/1187

The rewrite rules are consistantly trying to recreate themselves in the web.config file.

bringing the " Cannot add duplicate collection entry of type 'rule' with unique key attribute 'name' set to 'wordpress - strip index.php' "

over and over again

Change History (10)

comment:1 wpmuguru4 years ago

  • Keywords needs-feedback added

Code from the MU ticket:

function iis7_save_url_rewrite_rules(){
	global $wp_rewrite;

	$home_path = get_home_path();
	$web_config_file = $home_path . 'web.config';

	// Using win_is_writable() instead of is_writable() because of a bug in Windows PHP
	if ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) {
		if ( iis7_supports_permalinks() ) {
			$rule = $wp_rewrite->iis7_url_rewrite_rules(false, '', '');
			var_dump($rule);
//			if ( ! empty($rule) ) {
//				return iis7_add_rewrite_rule($web_config_file, $rule);
//			} else {
//				return iis7_delete_rewrite_rule($web_config_file);
//			}
		}
	}
	return false;
}

Frumph,
Can you add this before the if and let me know what it dumps out:

var_dump($web_config_file, file_exists($web_config_file));

comment:2 follow-up: Frumph4 years ago

string(32) "C:\inetpub\frumph.net/web.config" bool(true) 

comment:3 in reply to: ↑ 2 wpmuguru4 years ago

Replying to Frumph:

string(32) "C:\inetpub\frumph.net/web.config" bool(true) 

I see now. The if is true based on the win_is_writable() at the end. I'll poke around and see if I can find why the iis7_save_url_rewrite_rules is being called.

comment:4 follow-up: wpmuguru4 years ago

Frumph,

How often does it happen? Just in the admin area, every page view, etc.?

comment:5 wpmuguru4 years ago

  • Milestone changed from Unassigned to 3.0

Adding to the 3.0 list.

comment:6 wpmuguru4 years ago

This looks like it tracks back to the rewrite rules being flushed frequently.

comment:7 in reply to: ↑ 4 Frumph4 years ago

Replying to wpmuguru:

Frumph,

How often does it happen? Just in the admin area, every page view, etc.?

Sorry for not checking back on this. It was every pageview.

comment:8 ryan4 years ago

  • Milestone changed from 3.0 to 3.1

Planning a flush rules rework for 3.1.

comment:9 Frumph4 years ago

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

comment:10 Frumph4 years ago

  • Keywords needs-feedback removed
  • Milestone 3.1 deleted
Note: See TracTickets for help on using tickets.