Closed davidsword closed 4 months ago
Good catch.
This happens with Arabic as well; a redirect of: /فوتوغرافيا
(Photography) comes up as a 404 instead of redirecting.
The issue is that the $_SERVER['REQUEST_URI']
sees /🔥-deals
as /%F0%9F%94%A5-deals
, and so the md5 of the two strings is different, to the lookup fails.
str_replace( '%2F', '/', rawurlencode( '/🔥-deals` ) )
...matches $_SERVER['REQUEST_URI']
for a request of /🔥-deals
.
Need to consider at what point in the process is this introduced (Before saving to the DB? On lookup?), and how we maintain backwards compatibility for existing redirects.
@GaryJones We can decode the URL's on lookup which will match with how redirects are currently being stored in the posts table (preserving compatibility with existing + new redirects).
Following worked successfully ...
rawurldecode( $url );
MacBook-Air:WPCOM-Legacy-Redirector bryandwyer$ curl -I "http://rustyincorgchartbdtech.lndo.site/🔥-deals"
HTTP/1.1 301 Moved Permanently
Cache-Control: no-cache, must-revalidate, max-age=0
Content-Type: text/html; charset=UTF-8
Date: Thu, 30 May 2019 19:30:20 GMT
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Location: /sample-page/
Server: nginx/1.14.2
Set-Cookie: XDEBUG_SESSION=www-data; expires=Thu, 30-May-2019 20:30:19 GMT; Max-Age=3600; path=/
X-Frame-Options: SAMEORIGIN
X-Powered-By: PHP/7.2.16
X-Redirect-By: WPCOM Legacy Redirector
OK (8 tests, 16 assertions)
That sounds good - feel free to get a PR going for this!
Emojis and chars like the horizontal ellipsis
…
can be submitted successfully in the FROM path's, but they don't actually redirect.This could be a problem if for example this plugin is used as a shortener by marketers, ie:
/🔥-deals