Opened 13 years ago
Closed 12 years 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)
Change History (19)
#3
@
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.
#4
@
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:
↓ 7
@
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:
- Unlike
get_search_form()
, admin bar misses a slash when callinghome_url()
:
Should be: https://domain.tld/blogname/?s=test
Actual: https://domain.tld/blogname?s=test - For some reason, canonical redirect from ?s=test to /?s=test only happens on the main site.
get_pagenum_link()
then fails to properly replace$home_root
in$request
: http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/link-template.php#L1487
18034.patch fixes the first issue. Doesn't touch canonical redirect or get_pagenum_link()
.
#6
@
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.
#7
in reply to:
↑ 5
@
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()
.
#8
@
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
@
13 years ago
18034.patch solves the reported issue without touching redirects.
#10
@
13 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In [19405]:
#12
@
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.
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?