Ticket #18852: 18852.patch
File 18852.patch, 5.4 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/misc.php
19 19 } 20 20 21 21 /** 22 * Returns whether or not the server supports URL rewriting. 23 * 24 * @since 3.3 25 * 26 * @return bool Whether the server supports URL rewriting 27 */ 28 function got_url_rewrite() { 29 global $is_nginx; 30 $got_url_rewrite = ( got_mod_rewrite() or iis7_supports_permalinks() or $is_nginx ); 31 return apply_filters('got_url_rewrite', $got_url_rewrite); 32 } 33 34 /** 22 35 * {@internal Missing Short Description}} 23 36 * 24 37 * @since 1.5.0 -
wp-admin/options-permalink.php
59 59 $iis7_permalinks = iis7_supports_permalinks(); 60 60 61 61 $prefix = $blog_prefix = ''; 62 if ( ! got_ mod_rewrite() && ! $iis7_permalinks)62 if ( ! got_url_rewrite() ) 63 63 $prefix = '/index.php'; 64 64 if ( is_multisite() && !is_subdomain_install() && is_main_site() ) 65 65 $blog_prefix = '/blog'; … … 109 109 $writable = true; 110 110 else 111 111 $writable = false; 112 } else if ( $is_nginx ) { 113 $writable = false; 112 114 } else { 113 115 if ( ( ! file_exists($home_path . '.htaccess') && is_writable($home_path) ) || is_writable($home_path . '.htaccess') ) 114 116 $writable = true; … … 134 136 _e('Permalink structure updated. Remove write access on web.config file now!'); 135 137 else 136 138 _e('Permalink structure updated'); 139 } else if ( $is_nginx ) { 140 _e('Permalink structure updated. Ensure your nginx.conf (or equivalent) contains the rewrite rules below.'); 137 141 } else { 138 142 if ( $permalink_structure && ! $usingpi && ! $writable ) 139 143 _e('You should update your .htaccess now.'); … … 207 211 </table> 208 212 209 213 <h3><?php _e('Optional'); ?></h3> 210 <?php if ( $is_apache || $iis7_permalinks ) : ?>214 <?php if ( $is_apache || $iis7_permalinks || $is_nginx ) : ?> 211 215 <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <kbd>topics</kbd> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p> 212 216 <?php else : ?> 213 217 <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p> … … 248 252 <p><?php _e('If you temporarily make your site’s root directory writable for us to generate the <code>web.config</code> file automatically, do not forget to revert the permissions after the file has been created.') ?></p> 249 253 <?php endif; ?> 250 254 <?php endif; ?> 255 <?php elseif ( $is_nginx ) : 256 if ( $permalink_structure && ! $usingpi ) : ?> 257 <p><?php _e('These are the rewrite rules you should have in your <code>nginx.conf</code> (or equivalent) file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p> 258 <form action="options-permalink.php" method="post"> 259 <?php wp_nonce_field('update-permalink') ?> 260 <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->nginx_url_rewrite_rules() ); ?></textarea></p> 261 </form> 262 <?php endif; ?> 251 263 <?php else : 252 264 if ( $permalink_structure && ! $usingpi && ! $writable ) : ?> 253 265 <p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p> -
wp-includes/rewrite.php
1765 1765 } 1766 1766 1767 1767 /** 1768 * Retrieve Nginx formatted rewrite rules. 1769 * 1770 * @since 3.3.0 1771 * @access public 1772 * 1773 * @return string 1774 */ 1775 function nginx_url_rewrite_rules() { 1776 if ( ! $this->using_permalinks() ) 1777 return ''; 1778 1779 $rules = "location / {\n"; 1780 $rules .= "\t" . 'if ( -f $request_filename ) {' . "\n"; 1781 $rules .= "\t\tbreak;\n"; 1782 $rules .= "\t}\n"; 1783 $rules .= "\t" . 'try_files $uri $uri/ /index.php?$args;' . "\n"; 1784 $rules .= "}\n"; 1785 1786 $rules = apply_filters('nginx_rewrite_rules', $rules); 1787 1788 return $rules; 1789 } 1790 1791 /** 1768 1792 * Add a straight rewrite rule. 1769 1793 * 1770 1794 * Any value in the $after parameter that isn't 'bottom' will be placed at -
wp-includes/vars.php
83 83 $is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false); 84 84 85 85 /** 86 * Whether the server software is Nginx or something else 87 * @global bool $is_nginx 88 */ 89 $is_nginx = (strpos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false); 90 91 /** 86 92 * Whether the server software is IIS or something else 87 93 * @global bool $is_IIS 88 94 */