Git Product home page Git Product logo

Comments (3)

bdtech avatar bdtech commented on July 17, 2024

@jeremeylduvall Those pesky trailing slashes never go away :)

Thanks for scoping this out and for sharing the provided sample code. I was able to test, validate, and implement automatically supporting both scenarios (with or without the trailing slash). I also included query string compatibility as well and I'll be forking + committing code soon.

from wpcom-legacy-redirector.

bdtech avatar bdtech commented on July 17, 2024

@GaryJones Do we want to allow the creation of redirects ($from_url) for both trailing slash URL variants through the UI? It is currently allowed. This decision impacts how the most optimal solution is implemented for v1.4.0 and supported moving forward.

i.e...
https://example.com/redir to https://example.com/page1
https://example.com/redir/ to https://example.com/page2

Possible Solutions:
A) Consistent trailing slash agnostic support across the CLI, UI, and internally within the plugin. We'd uniformly consider the example above as one redirect route. Only the CLI can create a trailing slash variant with --skip-validation. We can apply the trailing slash policy based on the site's current permalink structure.
B) Allow these to operate as separate redirect routes as is allowed today. We'd add logic to maybe_do_redirect() to support a fallback check on the second possible URL - the trailing slash variant as outlined in this issue. We'd further optimize for performance.

Thoughts? Thank you, sir!

from wpcom-legacy-redirector.

bcampeau avatar bcampeau commented on July 17, 2024

+1 to this. We've had to hack the core plugin code for this use case.

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.