4

I have been recommended to try either Freeway or Router to handle some non-standard URLs that I solved with .htaccess rewrites on EE 1 but where those no longer work on EE 2.

In one case, I need to remove a non-default template group from URLs. In another case, I need to remove part of a Page URI.

Freeway, I am told, would handle both scenarios. Would Router?

It also appears that Router uses a config file instead of storing its settings within EE. Is there any non-subjective reason to prefer one method over the other, in terms of efficiency, for example?

2
  • This question is subjective and not a good fit here. Try to rephrase it so it's more inline with an actual purpose that fits your needs.
    – Eric Lamb
    Nov 29, 2012 at 21:40
  • 1
    Edited version is much better :) Nov 29, 2012 at 22:08

3 Answers 3

11

I've played with both, but not used either in production. Here's how I as an end user would sumarise the differences between Freeway and Router:

Freeway:

  • Free/Open Source (GPL) (+)
  • You can still access the original URL segments in your template
  • Friendlier/more "EE-like" routing syntax (+)
  • Stores routes in CP rather than a file - this is a biggie for me personally as something as core as routing should not IMO be in the DB (-)
  • Alpha/Beta state (- 0.0.1 release)

Router:

  • Commerical license (cost $ but hopefully better support)
  • You can pass variables into your target template by setting params on hte {exp:router} tag (+)
  • You can still access the original URL segments in your template
  • Can automatically set category variables based on routes. (+)
  • As it's loaded at the template stage, can easily be used with Structure or other addons that modify routing (+)
  • Regex-based routing syntax, which has a steep learning curve if you come from the designer-front-ender segment of the EE userbase, but once you get your head around it you can basically do anything you want.
  • Stores routes in a flat file, so easy to keep versioned. (+)
  • Production ready/more mature (1.0 release) (+)

In terms of preference I think it depends on the task at hand. Router is probably more mature, and is very powerful but can be tricky to grok if you're not comfortable with regex. Freeway has an easier learning curve but for me isn't production ready (and keeping routes in the DB is a killer no-no for me personally).

If you're just starting out with custom routing, Freeway has a little brother called Freebie which can be super-useful for routing "tweaks", like triggering non-routing template behaviour by passing custom segments.

PS Doug/Isaac: If I've misrepresented any features please do edit/comment and I'll be happy to fix

4
  • Thank you, that breakdown is really useful. I was leery of the idea of keeping the routing in a separate file, but I can see why that makes sense. That said, I don't do any versioning or use templates as files; this is a one person hobby-project and I am by no means a proper developer. :) Now, if I use Router, would I use that to get rid of index.php as well or would it work to still have the index.php rewrite in .htaccess and then have Router take care of the rest? Nov 30, 2012 at 13:55
  • 2
    Router/Freeway both act at the EE level - ie "after" index.php (as before index.php has been processed EE hasn't loaded). As requests still need to get to EE yes, you'd still want to remove index.php (I use the officially supported method though others are available too).
    – Tom Davies
    Nov 30, 2012 at 14:00
  • Note that in Router, all original segment variables are also available. Aside from that, this seems like a good breakdown to me. :) Nov 30, 2012 at 16:01
  • Thanks Isaac, I've updated my answer to make it clear that's possible with both Freeway & Router
    – Tom Davies
    Nov 30, 2012 at 16:09
3

I'm a fan of Freeway (started using it when Freebie, from the same author, didn't cut it in a project). Router is rather expensive, but on the other hand Freeway is still in "beta"-ish phase...

2

It also appears that Router uses a config file instead of storing its settings within EE. Is there any non-subjective reason to prefer one method over the other, in terms of efficiency, for example?

Assuming you're using a code versioning system ideally you want your config settings to be versioned so that they can easily be tracked, forked or rolled back with ease. This is especially important with core functionality such as routing. Keeping track of settings stored within the database is either convoluted or impossible, whereas a flat-file makes this stuff simple.

Having said that, and completely contradicting myself, I have used Freeway before to create a few basic single-segment URLs and it's always worked nicely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.