Ticket #18852: 18852.2.patch
File 18852.2.patch, 5.5 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; … … 123 125 124 126 $wp_rewrite->flush_rules(); 125 127 126 127 128 if (isset($_POST['submit'])) : ?> 128 129 <div id="message" class="updated"><p><?php 129 130 if ( ! is_multisite() ) { … … 134 135 _e('Permalink structure updated. Remove write access on web.config file now!'); 135 136 else 136 137 _e('Permalink structure updated'); 138 } else if ( $is_nginx ) { 139 if ( $permalink_structure ) 140 _e('Permalink structure updated. Ensure your nginx.conf (or equivalent) contains the rewrite rules below.'); 141 else 142 _e('Permalink structure updated.'); 137 143 } else { 138 144 if ( $permalink_structure && ! $usingpi && ! $writable ) 139 145 _e('You should update your .htaccess now.'); … … 207 213 </table> 208 214 209 215 <h3><?php _e('Optional'); ?></h3> 210 <?php if ( $is_apache || $iis7_permalinks ) : ?>216 <?php if ( $is_apache || $iis7_permalinks || $is_nginx ) : ?> 211 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 <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 218 <?php else : ?> 213 219 <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 254 <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 255 <?php endif; ?> 250 256 <?php endif; ?> 257 <?php elseif ( $is_nginx ) : 258 if ( $permalink_structure && ! $usingpi ) : ?> 259 <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> 260 <form action="options-permalink.php" method="post"> 261 <?php wp_nonce_field('update-permalink') ?> 262 <p><textarea rows="4" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->nginx_url_rewrite_rules() ); ?></textarea></p> 263 </form> 264 <?php endif; ?> 251 265 <?php else : 252 266 if ( $permalink_structure && ! $usingpi && ! $writable ) : ?> 253 267 <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" . 'try_files $uri $uri/ /index.php?$args;' . "\n"; 1781 $rules .= "}\n"; 1782 1783 $rules = apply_filters('nginx_rewrite_rules', $rules); 1784 1785 return $rules; 1786 } 1787 1788 /** 1768 1789 * Add a straight rewrite rule. 1769 1790 * 1770 1791 * 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 */