function iis7_save_url_rewrite_rules(){

Updates the IIS web.config file with the current rules if it is writable.
If the permalinks do not require rewrite rules then the rules are deleted from the web.config file.

Return values

returns:True if web.config was updated successfully

Source code

function iis7_save_url_rewrite_rules(){

	if ( is_multisite() )


	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 ( iis7_supports_permalinks() && ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) ) {

		$rule = $wp_rewrite->iis7_url_rewrite_rules(false, '', '');

		if ( ! empty($rule) ) {

			return iis7_add_rewrite_rule($web_config_file, $rule);

		} else {

			return iis7_delete_rewrite_rule($web_config_file);



	return false;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: