Skip to content

Fix redirects for non-ASCII request paths - #477

Open
sanketio wants to merge 1 commit into
10up:developfrom
sanketio:fix/non-ascii-redirect-paths
Open

sanketio wants to merge 1 commit into
10up:developfrom
sanketio:fix/non-ascii-redirect-paths

Conversation

@sanketio

@sanketio sanketio commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Description of the Change

sanitize_text_field() on REQUEST_URI stripped percent-encoded octets, so non-ASCII paths (e.g. /轉址/, /café/) never matched. Non-ASCII octets are now decoded before sanitizing and in match_redirect(); rules stored encoded still match, and %2F/%3F stay encoded.

Closes #442

How to test the Change

  1. Create a redirect from /轉址/ to /.
  2. Visit /轉址/ → redirected to the homepage (302, X-Safe-Redirect-Manager: true).
  3. npm run test:php

Changelog Entry

Fixed - Redirects for URLs containing non-ASCII characters, such as Chinese or accented letters.

Credits

Props @sanketio, @oecin

Checklist:

@jeffpaul jeffpaul added this to the 2.4.0 milestone Oct 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fail for URLs containing Chinese characters

2 participants