Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#7537 closed enhancement (fixed)

Strip trailing spaces with canonical URLs

Reported by: matt Owned by: markjaquith
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.6
Component: General Keywords: has-patch needs-testing
Focuses: Cc:


Apparently a really common trailing 404 is %20s, like http://ma.tt/%20%20. We should strip these and redirects. It's from links like this:

<a href="http:/ma.tt/ ">

Attachments (2)

trailing-spaces-canonical.diff (1.6 KB) - added by markjaquith 9 years ago.
7537.diff (1.3 KB) - added by DD32 9 years ago.

Download all attachments as: .zip

Change History (8)

#1 @markjaquith
9 years ago

That shows a draft to me, and is_preview() is true, so Canonical code can't be run. Need to figure out what WP_Query is showing a draft in this situation.

#2 @markjaquith
9 years ago

  • Keywords has-patch needs-testing added
  • Status changed from new to assigned

Try this patch. Fixes it for pretty permalinks and default permalinks (in most situations). As with other things here, I've crafted it to look for specific circumstances, instead of hitting the problem with a big hammer. Let me know if you find a popular 404 case that isn't covered.

#3 @markjaquith
9 years ago

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

(In [8667]) Strip trailing spaces in URLs, redirect to canonical URL. fixes #7537

#4 @DD32
9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I'm getting constantly redirected to <page-requested/>? now, ie. its allways adding the Query to the end.

I'll attach a patch to fix it.

9 years ago

#5 @markjaquith
9 years ago

(In [9197]) Switch to using empty()/!empty() checks in Canonical. see #7537

#6 @markjaquith
9 years ago

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

Closing. Reopen if issues remain.

Note: See TracTickets for help on using tickets.