iis7_supports_permalinks

Check if IIS 7+ supports pretty permalinks.

Description

iis7_supports_permalinks(); 

Usage

  1. if ( !function_exists( 'iis7_supports_permalinks' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = iis7_supports_permalinks(); 
  7.  

Defined (1)

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

/wp-includes/functions.php  
  1. function iis7_supports_permalinks() { 
  2. global $is_iis7; 
  3.  
  4. $supports_permalinks = false; 
  5. if ( $is_iis7 ) { 
  6. /** First we check if the DOMDocument class exists. If it does not exist, then we cannot 
  7. * easily update the xml configuration file, hence we just bail out and tell user that 
  8. * pretty permalinks cannot be used. 
  9. * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When 
  10. * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'. 
  11. * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs 
  12. * via ISAPI then pretty permalinks will not work. 
  13. */ 
  14. $supports_permalinks = class_exists( 'DOMDocument', false ) && isset($_SERVER['IIS_UrlRewriteModule']) && ( PHP_SAPI == 'cgi-fcgi' ); 
  15.  
  16. /** 
  17. * Filters whether IIS 7+ supports pretty permalinks. 
  18. * @since 2.8.0 
  19. * @param bool $supports_permalinks Whether IIS7 supports permalinks. Default false. 
  20. */ 
  21. return apply_filters( 'iis7_supports_permalinks', $supports_permalinks );