iis7_save_url_rewrite_rules

Updates the IIS web.config file with the current rules if it is writable.

Description

iis7_save_url_rewrite_rules(); 

If the permalinks do not require rewrite rules then the rules are deleted from the web.config file.


Usage

  1. if ( !function_exists( 'iis7_save_url_rewrite_rules' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/misc.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = iis7_save_url_rewrite_rules(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/misc.php  
  1. function iis7_save_url_rewrite_rules() { 
  2. if ( is_multisite() ) 
  3. return; 
  4.  
  5. global $wp_rewrite; 
  6.  
  7. $home_path = get_home_path(); 
  8. $web_config_file = $home_path . 'web.config'; 
  9.  
  10. // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP 
  11. 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) ) ) { 
  12. $rule = $wp_rewrite->iis7_url_rewrite_rules(false, '', ''); 
  13. if ( ! empty($rule) ) { 
  14. return iis7_add_rewrite_rule($web_config_file, $rule); 
  15. } else { 
  16. return iis7_delete_rewrite_rule($web_config_file); 
  17. return false;