WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#22084 closed defect (bug) (invalid)

Tag pagination issue on nginx-hosted installs

Reported by: iridox Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Rewrite Rules Keywords:
Focuses: Cc:

Description

Due to the seeming lack of tickets on this, I'm going to assume it's an nginx-specific issue.

Basically, since 3.4 I've had to include a custom function on each of my nginx-hosted WordPress installations to get tag pagination to work:

add_action('init','yoursite_init');
function yoursite_init() {
  global $wp_rewrite;
		//add rewrite rule.
                add_rewrite_rule("tag/(.+?)/page/?([0-9]{1,})/?$",'index.php?tag=$matches[1]&paged=$matches[2]','top');
                $wp_rewrite->flush_rules(false);
}

Without the code block, I either get a 310 Error (redirect loop) or a random page is spitted out.

Change History (4)

#1 @markoheijnen
8 years ago

It seems you have something else wrong. For me it works on a test site running 3.4.1.

#2 @SergeyBiryukov
8 years ago

Didn't test with nginx yet, but the rule in yoursite_init() is similar to the default one:

tag/([^/]+)/page/?([0-9]{1,})/?$ => index.php?tag=$matches[1]&paged=$matches[2]
tag/(.+?)/page/?([0-9]{1,})/?$ => index.php?tag=$matches[1]&paged=$matches[2]

The only difference is ([^/]+) vs. (.+?), which doesn't seem relevant.

#3 @iridox
8 years ago

I'm going to do some more testing on my side - maybe there's something I missed.

#4 @nacin
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
$ curl --head http://nacin.com/tag/wordpress/page/2/
HTTP/1.1 200 OK
Server: nginx/1.2.3
Note: See TracTickets for help on using tickets.