LulububuSoftwareGmbH / boltredirector

Handles 301 redirects in Bolt CMS.
16 stars 8 forks source link

:all and :any not working properly. #17

Open madc opened 7 years ago

madc commented 7 years ago

This is a known bug. After consulting the author, we found out that /unternehmen/{slug:segments} works as a workaround.

On slack, @SahAssar wrote: "I'm planning to rewrite it to use common regexes instead, I never understood why it tries to define it's own DSL just for redirects"

mikerockett commented 7 years ago

The DSL was influenced by a routing library I'd seen when I originally wrote the package. The purpose was simple: an easy to understand syntax for those who don't know regex well enough. As most redirects these days are slug-based (source and destination), I'd now recommend FastRoute as a handler - it provides the combination of simplicity and specificity.

SvanteRichter commented 7 years ago

@mikerockett I see... My plan was to simplify it (implementation wise) to use regexes and then provide a "cookbook" of common regexes/redirects in a doc/wiki/readme to help people not used to regex. If you want to keep the syntax simple and readable perhaps we can simply prepend/append routes to the normal symfony/silex routing and provide a common controller endpoint to actually handle the actual redirect. The current approach feels a bit NIH to me (no offense intended). FastRoute looks great, but since bolt already ships with a routing lib it's probably easiest to just use that, no?

mikerockett commented 7 years ago

Of course, no offense taken. Tbh, it was designed this way (implementation) as I had no clue how to work with the various routing packages available, even the Symfony one, but have come a long way since then. Additionally, thought it would have been a nice idea to build it from scratch and keep the package small. Only recommending FastRoute because of the syntax. Also, it's so ridiculously fast that it shouldn't really mean anything to include it. I'm using it in Jumplinks 2 for ProcessWire, and there are already some significant speed gains when there are a lot of redirects.

End of the day: I handed this over to you, so please feel free to do as you deem fit - you probably know what Bolt users want more than I do.

madc commented 7 years ago

As said in #18, this extension is mainly for developers, so with a well enough documentation, regex gives you the most flexibility. Maybe an additional default wildcard (*) would be cool tough.