Git Product home page Git Product logo

Comments (3)

GaryJones avatar GaryJones commented on July 17, 2024

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.

from wpcom-legacy-redirector.

bdtech avatar bdtech commented on July 17, 2024

@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)

from wpcom-legacy-redirector.

GaryJones avatar GaryJones commented on July 17, 2024

That sounds good - feel free to get a PR going for this!

from wpcom-legacy-redirector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.