[wp-trac] [WordPress Trac] #64376: redirect_canonical() causes unnecessary 301 redirects for query string encoding variants (+ vs %20)

WordPress Trac noreply at wordpress.org
Mon Dec 8 12:40:25 UTC 2025


#64376: redirect_canonical() causes unnecessary 301 redirects for query string
encoding variants (+ vs %20)
----------------------------+------------------------------
 Reporter:  robbertvancaem  |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Canonical       |     Version:  6.8.3
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+------------------------------
Changes (by iflairwebtechnologies):

 * keywords:   => has-patch


Comment:

 When redirect_canonical() rebuilt URLs, it sometimes triggered 301
 redirects
 only because the query string used an encoded variant (e.g. " " vs "%20"
 or "+").
 This change compares decoded URLs and suppresses redirects when decoded
 forms
 are identical, avoiding harmful encoding-only 301s that cause caching
 issues
 and break tracking parameters. See Trac #64376.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64376#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list