[wp-trac] Re: [WordPress Trac] #3514: IIS fix for get_pagenum_link

WordPress Trac wp-trac at lists.automattic.com
Sat May 26 01:20:02 GMT 2007


#3514: IIS fix for get_pagenum_link
---------------------------------------------------+------------------------
 Reporter:  snakefoot                              |        Owner:  markjaquith
     Type:  defect                                 |       Status:  assigned   
 Priority:  high                                   |    Milestone:  2.3        
Component:  General                                |      Version:  2.0        
 Severity:  major                                  |   Resolution:             
 Keywords:  get_pagenum_link, iis, posts_nav_link  |  
---------------------------------------------------+------------------------
Comment (by snakefoot):

 With the #3930 solved, the get_pagenum_link() looks much prettier and by
 changing the following lines it should work with IIS (Notice the
 str_replace):

 {{{
      if ( !$wp_rewrite->using_permalinks() ) {
         $base = trailingslashit( get_bloginfo( 'home' ) );

         if ( $pagenum > 1 ) {
             $result = add_query_arg( 'paged', $pagenum, $base . $request
 );
         } else {
             $result = $base . $request;
         }
     } else {
         $request = str_replace('index.php/', '', $request);
         $request = str_replace('index.php', '', $request);

         $request = preg_replace( '|/?page/(.+)$|', '', $request);
 }}}

 Along with modifying REQUEST_URI in wp_settings.php (Will also make WP-
 Cache work out of the box):

 {{{
      // Fix for IIS, which doesn't set REQUEST_URI
      if ( empty( $_SERVER['REQUEST_URI'] ) ) {
         $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] .
 $_SERVER['PATH_INFO'];
 }}}

 Must admit that I have only tested this on 2.0 (Exchanged the original
 get_pagenum_link with the new one in version 2.3). Have tested with
 permalink using index.php without ISAPI rewrite, and without index.php
 using ISAPI rewrite, and everything (pages, posts, categories, archives,
 search, paged) works as they should.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3514#comment:8>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list