WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 22 months ago

#18034 closed defect (bug) (fixed)

Incorrect URL for second page of search results

Reported by: mark.waters Owned by: 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 3 years ago.
18034.2.patch (1.4 KB) - added by SergeyBiryukov 3 years ago.
18034.3.patch (1.9 KB) - added by SergeyBiryukov 3 years ago.
18034.4.patch (572 bytes) - added by SergeyBiryukov 22 months ago.

Download all attachments as: .zip

Change History (19)

comment:1 SergeyBiryukov3 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?

comment:2 mark.waters3 years ago

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

comment:3 Ipstenu3 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 3 years ago by Ipstenu (previous) (diff)

comment:4 mark.waters3 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.

SergeyBiryukov3 years ago

comment:5 follow-up: SergeyBiryukov3 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().

SergeyBiryukov3 years ago

SergeyBiryukov3 years ago

comment:6 Ipstenu3 years ago

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

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

comment:7 in reply to: ↑ 5 SergeyBiryukov3 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 3 years ago by SergeyBiryukov (previous) (diff)

comment:8 azaozz2 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.

comment:9 SergeyBiryukov2 years ago

18034.patch solves the reported issue without touching redirects.

comment:10 nacin2 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.

comment:11 nacin2 years ago

In [19406]:

Because we can. see #18034.

comment:12 nacin2 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.

SergeyBiryukov22 months ago

comment:14 SergeyBiryukov22 months 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).

comment:15 markjaquith22 months 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.