Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#7537 closed enhancement (fixed)

Strip trailing spaces with canonical URLs

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

Description

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 18 years ago.
7537.diff​ (1.3 KB ) - added by DD32 18 years ago.

Download all attachments as: .zip

Change History (8)

#1 @markjaquith
18 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
18 years ago

  • Keywords has-patch needs-testing added
  • Status new → 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
18 years ago

  • Resolution → fixed
  • Status assigned → closed

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

#4 @DD32
18 years ago

  • Resolution fixed
  • Status closed → 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.

#5 @markjaquith
18 years ago

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

#6 @markjaquith
18 years ago

  • Resolution → fixed
  • Status reopened → closed

Closing. Reopen if issues remain.

Note: See TracTickets for help on using tickets.