Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#11723 closed defect (bug) (duplicate)

Search Results Paging Doesn't Work Using Wordpress as 404 Handler

Reported by: danrha's profile danrha Owned by:
Milestone: Priority: normal
Severity: major Version: 2.9.1
Component: General Keywords: search pages, 404, lighttpd
Focuses: Cc:

Description

I'm running Wordpress on lighttpd, using server.error-handler-404 = "index.php", all the pretty permalinks work perfectly. However, when doing a search, i only get the first results page, that is mysite.com/?s=query works but mysite.com/page/2/?s=query doesn't (i get shown the home page saying it's on page two of it). Paging on categories, archives and tags works as expected too.

I believe this is a Wordpress error, as the variables are being correctly passed to the script. Strangely mysite.com/index.php/page/2/?s=query works as expected, i have tried exploring the code but i don't really know about the internals of the wordpress core.

Change History (5)

#1 @danrha
15 years ago

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

i have fixed it, wordpress doesn't look for query strings in the url... i made this function and added it to wp-settings.php and made it run right after wp_unregister_globals

function wp_fix_lighttpd() { checks if URI has parameter and sets globals

if (isset($_GET) && isset($_SERVERQUERY_STRING?)) return;
$donga = explode('?', $_SERVERREQUEST_URI?, 2);
if (count($donga) > 1) {

$_SERVERQUERY_STRING? = $donga[1]; set query string
parse_str($donga[1], $_GET);
parse it and set get global
$_REQUEST = array_merge( (array)$_GET, (array)$_REQUEST); set request global

}

}

#2 @danrha
15 years ago

function wp_fix_lighttpd() { //checks if URI has parameter and sets globals
	if (isset($_GET) && isset($_SERVER['QUERY_STRING'])) return;
	$donga = explode('?', $_SERVER['REQUEST_URI'], 2);
	if (count($donga) > 1) { 
		$_SERVER['QUERY_STRING'] = $donga[1];
		parse_str($donga[1], $_GET);
		$_REQUEST = array_merge( (array)$_GET, (array)$_REQUEST);
	}
}

#3 @nacin
15 years ago

  • Milestone changed from Unassigned to 3.0
  • Resolution fixed deleted
  • Status changed from closed to reopened

I'm glad you've fixed it for you. Now it needs to be handled for all lighttpd WordPress installs.

#4 @hakre
15 years ago

Pleae see this ticket as well: #11511. This might be related.

#5 @miqrogroove
15 years ago

  • Milestone 3.0 deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed

#10458 Code is slightly different, but does the same thing.

Note: See TracTickets for help on using tickets.