Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#18034 closed defect (bug) (fixed)

Incorrect URL for second page of search results

Reported by: markwaters's profile mark.waters Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.2
Component: Multisite Keywords: has-patch needs-testing needs-unit-tests
Focuses: Cc:

Description

I enter the Search Term (uptime) into search box in Adminbar

First page of results shows up fine at :-
https://domain.tld/blogname?s=uptime

Link to second page of search results shows blogname repeated :-
https://domain.tld/blogname/blogname/page/2/?s=uptime

If I edit the URL manually and visit :-
https://domain.tld/blogname/page/2/?s=uptime
it works fine.

Link to the third page of search results shows fine too :-
https://domain.tld/blogname/page/3/?s=uptime

Also fourth and fifth pages are OK.

Regular page links are fine :-
https://domain.tld/blogname/page/2/

I have tested on three different blogs hosted on this multisite.
Changed themes (P2 and Twenty Eleven), same results.
Tested with Firefox and Chrome browsers.

Attachments (4)

18034.patch (754 bytes) - added by SergeyBiryukov 13 years ago.
18034.2.patch (1.4 KB) - added by SergeyBiryukov 13 years ago.
18034.3.patch (1.9 KB) - added by SergeyBiryukov 13 years ago.
18034.4.patch (572 bytes) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (19)

#1 @SergeyBiryukov
13 years ago

  • Keywords reporter-feedback added; search removed

Can't reproduce this.

https://domain.tld/blogname?s=uptime is redirected to https://domain.tld/blogname/?s=uptime (with slash), and the link to the second page is https://domain.tld/blogname/page/2/?s=uptime.

What's your permalink structure?

#2 @mark.waters
13 years ago

All the blogs are set to - "Day and name" permalink structure.

#3 @Ipstenu
13 years ago

I can reproduce this on my site as well.

Permalinks set to /post-id/postname. Was able to repro with ugly permalinks as well. All page twos double up the blogname.

See http://wordpress.org/support/topic/multi-site-admin-bar-search-returning-bad-urls

ETA: This only happens with admin-bar searching. Normal widget caused search is fine.

Last edited 13 years ago by Ipstenu (previous) (diff)

#4 @mark.waters
13 years ago

Can confirm it only affects Adminbar search , added search Widget to sidebar and this works as expected.

Somewhat reassuring that its happening to others , thanks Ipstenu.

#5 follow-up: @SergeyBiryukov
13 years ago

  • Component changed from General to Multisite
  • Keywords has-patch added; reporter-feedback removed
  • Milestone changed from Awaiting Review to 3.3

Ah, I was only checking a single site install.

This is a combination of several issues:

18034.patch fixes the first issue. Doesn't touch canonical redirect or get_pagenum_link().

#6 @Ipstenu
13 years ago

Tested on 3.3-beta and it works perfectly. While not a complete fix, putting this in 3.3 will restore functionality.

Version 0, edited 13 years ago by Ipstenu (next)

#7 in reply to: ↑ 5 @SergeyBiryukov
13 years ago

Replying to SergeyBiryukov:

  • For some reason, canonical redirect from ?s=test to /?s=test only happens on the main site.

Turned out there's no canonical redirect on the main site too. The slash is added by browser (on a sub-domain install) or Apache (on a sub-directory install with WP in a non-root directory).

18034.2.patch is an attempt to consistently perform a redirect for all sites in the network.

18034.3.patch also fixes the third issue. Looks like we don't need trailingslashit() here, as the slash is then removed by the second preg_replace().

Last edited 13 years ago by SergeyBiryukov (previous) (diff)

#8 @azaozz
13 years ago

  • Keywords needs-testing needs-unit-tests 3.4-early added
  • Milestone changed from 3.3 to Future Release

Anything that touches redirects should have unit test, right? Not a regression or a new problem, moving to 3.4.

#9 @SergeyBiryukov
13 years ago

18034.patch solves the reported issue without touching redirects.

#10 @nacin
13 years ago

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

In [19405]:

Trailing slash home_url() for the form action for admin bar search. props SergeyBiryukov. Escape too. fixes #18034 for 3.3.

#11 @nacin
13 years ago

In [19406]:

Because we can. see #18034.

#12 @nacin
13 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Re-opening for 3.4, but, there are almost positively other tickets that address all other issues here already. If someone can find them, please re-close this as fixed on 3.3.

#14 @SergeyBiryukov
12 years ago

  • Keywords 3.4-early removed
  • Milestone changed from Future Release to 3.5

Closed #21011 as a duplicate.

Refreshed the get_pagenum_link() patch (see comment:5 and comment:7).

#15 @markjaquith
12 years ago

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

In [21174]:

More reliably replace $home_root in $request in get_pagenum_link(). props SergeyBiryukov. fixes #18034

Note: See TracTickets for help on using tickets.