WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#7406 closed defect (bug) (invalid)

get_pagenum_link broken for IIS resurfaces

Reported by: skaufmann Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.6
Component: General Keywords: get_pagenum_link, categories, tags, navigation
Focuses: Cc:

Description

It appears the navigation links within a category or tag have broken again in IIS. This issue was outline in early 2007 here:

http://trac.wordpress.org/ticket/3514

The issue can be seen on my wordpress.

When viewing -

http://www.karieandscott.com/blog/category/gallery

and selecting next page at the bottom, the links are stripping out the category. It takes you to -

http://www.karieandscott.com/blog/page/2

instead of -

http://www.karieandscott.com/blog/category/gallery/page/2

I am running IIS Isapi Rewrite. My permalinks work fine. I am the server admin so any server config can be done if necessary to test.

Permalink Settings

Custom Structure: /%postname%

Category: /category

Tag: /tag

My .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/

# BEGIN WordPress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule . /index.php [L]
RewriteRule (.+) index.php/$1 [L,QSA]
# END WordPress
</IfModule>

I have reviewed all support forum posts and trac tickets but all relate to 2007 releases. template-functions-links.php has changed to link-template.php and code is no longer consistent or already includes the changes outlined in the trac tickets.

Attachments (1)

7406.diff (1.1 KB) - added by ryan 6 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 skaufmann6 years ago

I just wanted to confirm I am running 2.6.

comment:2 skaufmann6 years ago

Also, changing permalink structure to default doesn't solve the problem as some have said works in old release bugs.

comment:4 skaufmann6 years ago

Yes I saw both of those. They seem like similar symptoms but both are in wp-admin/edit.php. I don't have this problem. The problem is only when viewing the post and navigating within a category or tag. Navigation within the main index works perfectly.

comment:5 ryan6 years ago

Okay, some people had both problems. Could you dump the $_SERVER var as described in #7058? There's also a patch there to try, but I don't think it will help you if the edit.php paging works for you.

comment:6 skaufmann6 years ago

Here is the dump from this url

http://www.karieandscott.com/blog/category/gallery

<h2>SERVER</h2><pre>Array
(
    [ALL_HTTP] => HTTP_CONNECTION:keep-alive
HTTP_KEEP_ALIVE:300
HTTP_ACCEPT:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_CHARSET:ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_ACCEPT_ENCODING:gzip,deflate
HTTP_ACCEPT_LANGUAGE:en-us,en;q=0.5
HTTP_COOKIE:comment_author_dbcc6f3046640ab8cc3f837c53f32e0c=Diane; comment_author_email_dbcc6f3046640ab8cc3f837c53f32e0c=dkranek%40yahoo.com; wordpress_logged_in_dbcc6f3046640ab8cc3f837c53f32e0c=skaufmann%7C1217576732%7Ce84caf3560ecad52523b133542fd3ecf; GALLERYSID=0b221856c08b751b4adaa1dd2565538a; wassup=87175bad69afefba2139eee2c31568d9%3A%3A1217006547; dbx-postmeta=grabit:0+|1-|2-|3-|4-|5-|6-&advancedstuff:0-|1-|2-|3-|4-; __utma=185857971.757876208.1208169859.1216888127.1216934517.28; __utmz=185857971.1208169859.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); sessionCookie=Q7ALCOECGYZY4L11JK6AKDEGIPPZKGYK; wooTracker=VZ500323YZW6BA8XTARMMBUF8IOWK4SU; PHPSESSID=2a14a3962792cee297365ed197fbef33; __utmc=185857971; ASPSESSIONIDSQQBDDCQ=LOJHDONDHNCLIGOEBGFPMHNK; ASPSESSIONIDQSRBDBAT=GGJJLFLAGDNADOKKHEMPALAL
HTTP_HOST:www.karieandscott.com
HTTP_IF_MODIFIED_SINCE:Thu, 24 Jul 2008 19:51:13 GMT
HTTP_USER_AGENT:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
HTTP_X_REWRITE_URL:/blog/category/gallery

    [HTTPS] => off
    [SCRIPT_NAME] => /blog/index.php
    [HTTP_COOKIE] => comment_author_dbcc6f3046640ab8cc3f837c53f32e0c=Diane; comment_author_email_dbcc6f3046640ab8cc3f837c53f32e0c=dkranek%40yahoo.com; wordpress_logged_in_dbcc6f3046640ab8cc3f837c53f32e0c=skaufmann%7C1217576732%7Ce84caf3560ecad52523b133542fd3ecf; GALLERYSID=0b221856c08b751b4adaa1dd2565538a; wassup=87175bad69afefba2139eee2c31568d9%3A%3A1217006547; dbx-postmeta=grabit:0+|1-|2-|3-|4-|5-|6-&advancedstuff:0-|1-|2-|3-|4-; __utma=185857971.757876208.1208169859.1216888127.1216934517.28; __utmz=185857971.1208169859.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); sessionCookie=Q7ALCOECGYZY4L11JK6AKDEGIPPZKGYK; wooTracker=VZ500323YZW6BA8XTARMMBUF8IOWK4SU; PHPSESSID=2a14a3962792cee297365ed197fbef33; __utmc=185857971; ASPSESSIONIDSQQBDDCQ=LOJHDONDHNCLIGOEBGFPMHNK; ASPSESSIONIDQSRBDBAT=GGJJLFLAGDNADOKKHEMPALAL
    [AUTH_PASSWORD] => 
    [AUTH_TYPE] => 
    [AUTH_USER] => 
    [CONTENT_LENGTH] => 0
    [CONTENT_TYPE] => 
    [PATH_TRANSLATED] => G:\\inetpub\\wwwroot\\karieandscott.com\\wwwroot\\category\\gallery
    [QUERY_STRING] => 
    [REMOTE_ADDR] => 79.144.205.190
    [REMOTE_HOST] => 79.144.205.190
    [REMOTE_USER] => 
    [REQUEST_METHOD] => GET
    [SERVER_NAME] => www.karieandscott.com
    [SERVER_PORT] => 80
    [SERVER_PROTOCOL] => HTTP/1.1
    [SERVER_SOFTWARE] => Microsoft-IIS/6.0
    [APPL_MD_PATH] => /LM/W3SVC/4541/ROOT
    [APPL_PHYSICAL_PATH] => G:\\inetpub\\wwwroot\\karieandscott.com\\wwwroot\\
    [INSTANCE_ID] => 4541
    [INSTANCE_META_PATH] => /LM/W3SVC/4541
    [LOGON_USER] => 
    [REQUEST_URI] => /blog/index.php
    [URL] => /blog/index.php/category/gallery
    [SCRIPT_FILENAME] => G:\\inetpub\\wwwroot\\karieandscott.com\\wwwroot\\blog\\index.php
    [ORIG_PATH_INFO] => /blog/index.php/category/gallery
    [PATH_INFO] => /category/gallery
    [ORIG_PATH_TRANSLATED] => G:\\inetpub\\wwwroot\\karieandscott.com\\wwwroot\\blog\\index.php\\category\\gallery
    [DOCUMENT_ROOT] => G:\\inetpub\\wwwroot\\karieandscott.com\\wwwroot
    [PHP_SELF] => /blog/index.php
    [HTTP_CONNECTION] => keep-alive
    [HTTP_KEEP_ALIVE] => 300
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
    [HTTP_ACCEPT_ENCODING] => gzip,deflate
    [HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
    [HTTP_HOST] => www.karieandscott.com
    [HTTP_IF_MODIFIED_SINCE] => Thu, 24 Jul 2008 19:51:13 GMT
    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
    [HTTP_X_REWRITE_URL] => /blog/category/gallery
    [REQUEST_TIME] => 1217005864
    [argv] => Array
        (
        )

    [argc] => 0
)
</pre>

comment:7 skaufmann6 years ago

I figured I give the patch a shot but the diff doesn't say what file this change is made to. I'm hunting for it but the snippet is too small to figure it out.

comment:8 skaufmann6 years ago

Never mind. I'm blind... wp-settings.php

comment:9 skaufmann6 years ago

Added the code to my wp-settings.php but no fix.

ryan6 years ago

comment:10 ryan6 years ago

REQUEST_URI is set to the wrong thing. Typically when IIS Isapi Rewrite is used REQUEST_URI is blank. Try the 7406.diff patch. Test paging on the Manage->Posts page as well to make sure this patch doesn't break that. If you have problems applying the patch I can attach the revised wp-settings.php.

comment:11 ryan6 years ago

BTW, did you use previous versions of WP on this server setup? Was the bug in those versions too, or is it new to 2.6?

comment:12 skaufmann6 years ago

Unfortunately the patch didn't work. Here is the full Isapi Rewrite snippet from my wp-setting.php with your patch.

	// IIS Isapi_Rewrite
	else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
		$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
        } 
        else 
        { 
        		// Use ORIG_PATH_INFO if there is no PATH_INFO 
        		if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) ) 
        			$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; 
		 
		        // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) 
		        if ( isset($_SERVER['PATH_INFO']) ) { 
		        	if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) 
					 			$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; 
		        } 
        } 
} else if ( $_SERVER['REQUEST_URI'] == $_SERVER['PHP_SELF'] ) { 
        // If REQUEST_URI is the same as PHP_SELF, look for something more authoritative 
        if ( !empty($_SERVER['HTTP_X_REWRITE_URL']) ) 
                $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; 
        else if ( !empty($_SERVER['HTTP_X_ORIGINAL_URL']) ) 
                $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; 
} 
 
// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests


I don't know when it started. I haven't, till 2.6, started relying on category pagination for my blog. I migrated from WGP2 to embedded gallery because of the new features in 2.6 and began relying on the category to organize my galleries.

comment:13 ryan6 years ago

I think I need to get a dump of $_SERVER before we manipulate it. Can you add this:

print_r($_SERVER);

in wp-settings.php right before:

// Fix for IIS, which doesn't set REQUEST_URI

That will output to your blog, so remove it when you're done.

comment:14 skaufmann6 years ago

Here is the dump

Array ( [ALL_HTTP] => HTTP_CONNECTION:keep-alive HTTP_KEEP_ALIVE:300 HTTP_ACCEPT:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_ACCEPT_CHARSET:ISO-8859-1,utf-8;q=0.7,*;q=0.7 HTTP_ACCEPT_ENCODING:gzip,deflate HTTP_ACCEPT_LANGUAGE:en-us,en;q=0.5 HTTP_COOKIE:back_settings=mapType%3D3%26lat%3D42.94033923363183%26lng%3D-3.5595703125%26zoom%3D5; back_search=; comment_author_dbcc6f3046640ab8cc3f837c53f32e0c=Diane; comment_author_email_dbcc6f3046640ab8cc3f837c53f32e0c=dkranek%40yahoo.com; wordpress_logged_in_dbcc6f3046640ab8cc3f837c53f32e0c=skaufmann%7C1217576732%7Ce84caf3560ecad52523b133542fd3ecf; GALLERYSID=0b221856c08b751b4adaa1dd2565538a; wassup=a527788791eba9698a51dab1fbab790a%3A%3A1217233677; dbx-postmeta=grabit:0+|1-|2-|3-|4-|5-|6-&advancedstuff:0-|1-|2-|3-|4-; utma=185857971.757876208.1208169859.1216888127.1216934517.28; utmz=185857971.1208169859.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); sessionCookie=Q7ALCOECGYZY4L11JK6AKDEGIPPZKGYK; wooTracker=VZ500323YZW6BA8XTARMMBUF8IOWK4SU; ASPSESSIONIDQSRBDBAT=GHJJLFLAJMCKKPGHPDLANDCL; PHPSESSID=2c394984b66ea82466d43b0a61198592; ASPSESSIONIDQSTAABBT=MHHJBIIBINJDAMHOEPKOFMMD; ASPSESSIONIDSQTCBCCR=KAJPKDFCOGDDOPOLNILKDJIK HTTP_HOST:www.karieandscott.com HTTP_IF_MODIFIED_SINCE:Sun, 27 Jul 2008 17:34:11 GMT HTTP_USER_AGENT:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 HTTP_X_REWRITE_URL:/blog/category/gallery [HTTPS] => off [SCRIPT_NAME] => /blog/index.php [HTTP_COOKIE] => back_settings=mapType%3D3%26lat%3D42.94033923363183%26lng%3D-3.5595703125%26zoom%3D5; back_search=; comment_author_dbcc6f3046640ab8cc3f837c53f32e0c=Diane; comment_author_email_dbcc6f3046640ab8cc3f837c53f32e0c=dkranek%40yahoo.com; wordpress_logged_in_dbcc6f3046640ab8cc3f837c53f32e0c=skaufmann%7C1217576732%7Ce84caf3560ecad52523b133542fd3ecf; GALLERYSID=0b221856c08b751b4adaa1dd2565538a; wassup=a527788791eba9698a51dab1fbab790a%3A%3A1217233677; dbx-postmeta=grabit:0+|1-|2-|3-|4-|5-|6-&advancedstuff:0-|1-|2-|3-|4-; utma=185857971.757876208.1208169859.1216888127.1216934517.28; utmz=185857971.1208169859.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); sessionCookie=Q7ALCOECGYZY4L11JK6AKDEGIPPZKGYK; wooTracker=VZ500323YZW6BA8XTARMMBUF8IOWK4SU; ASPSESSIONIDQSRBDBAT=GHJJLFLAJMCKKPGHPDLANDCL; PHPSESSID=2c394984b66ea82466d43b0a61198592; ASPSESSIONIDQSTAABBT=MHHJBIIBINJDAMHOEPKOFMMD; ASPSESSIONIDSQTCBCCR=KAJPKDFCOGDDOPOLNILKDJIK [AUTH_PASSWORD] => [AUTH_TYPE] => [AUTH_USER] => [CONTENT_LENGTH] => 0 [CONTENT_TYPE] => [PATH_TRANSLATED] => G:\inetpub\wwwroot\karieandscott.com\wwwroot\category\gallery [QUERY_STRING] => [REMOTE_ADDR] => 79.144.205.190 [REMOTE_HOST] => 79.144.205.190 [REMOTE_USER] => [REQUEST_METHOD] => GET [SERVER_NAME] => www.karieandscott.com [SERVER_PORT] => 80 [SERVER_PROTOCOL] => HTTP/1.1 [SERVER_SOFTWARE] => Microsoft-IIS/6.0 [APPL_MD_PATH] => /LM/W3SVC/4541/ROOT [APPL_PHYSICAL_PATH] => G:\inetpub\wwwroot\karieandscott.com\wwwroot\ [INSTANCE_ID] => 4541 [INSTANCE_META_PATH] => /LM/W3SVC/4541 [LOGON_USER] => [REQUEST_URI] => /blog/category/gallery [URL] => /blog/index.php/category/gallery [SCRIPT_FILENAME] => G:\inetpub\wwwroot\karieandscott.com\wwwroot\blog\index.php [ORIG_PATH_INFO] => /blog/index.php/category/gallery [PATH_INFO] => /category/gallery [ORIG_PATH_TRANSLATED] => G:\inetpub\wwwroot\karieandscott.com\wwwroot\blog\index.php\category\gallery [DOCUMENT_ROOT] => G:\inetpub\wwwroot\karieandscott.com\wwwroot [PHP_SELF] => /blog/index.php [HTTP_CONNECTION] => keep-alive [HTTP_KEEP_ALIVE] => 300 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7 [HTTP_ACCEPT_ENCODING] => gzip,deflate [HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5 [HTTP_HOST] => www.karieandscott.com [HTTP_IF_MODIFIED_SINCE] => Sun, 27 Jul 2008 17:34:11 GMT [HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 [HTTP_X_REWRITE_URL] => /blog/category/gallery [REQUEST_TIME] => 1217231931 [argv] => Array ( ) [argc] => 0 )

comment:15 skaufmann6 years ago

One other thing I notice as of upgrading to 2.6 is one of my stats programs only sees blog/index.php as the visited URL when it should be the permalink. I don't know if that has anything to do with this. Just thought the get_pagenum_link may somehow be seeing the same thing even when viewing a category.

comment:16 ryan6 years ago

REQUEST_URI is set correctly in that dump. So it must be getting stomped somewhere between the beginning and the end. WP shouldn't touch it if it is already set. Can you try disabling plugins to see if that helps? I'll keep looking to see if we're touching REQUEST_URI somewhere we shouldn't.

comment:17 skaufmann6 years ago

  • Resolution set to invalid
  • Status changed from new to closed

I'm disappointed in myself. It was the CForms plugin. I'm usually quick to eliminate the plugin possibility but for some reason it didn't occur to me this time.

Thanks for you time.

comment:18 thee176 years ago

  • Milestone 2.7 deleted
Note: See TracTickets for help on using tickets.