Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Custom Routes with Wildcard

edited August 2010 in Vanilla 2.0 - 2.8
I'm new to Vanilla and developing a CMS as an application but I'm stuck trying to define some custom routes with wildcard matches.

I assumed they should look something like:

$Configuration['Routes']['posts/:num'] = 'Posts/Show/$1';

I've tried all sorts of variations but just can't get it to work. I can only get it to work if I use actual values instead of pattern matching.


  • Options
    Well it looks like I was probably going about it wrong and I'm using the 'Manage Routes' section in the dashboard instead.

    I still have to use an actual regular expression as the route instead of :num or :alphanum but I'm still unsure whether I'm missing something or it's a bug.
  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    You do have to use regular expressions. Try:
    'posts/(\d+)' = 'posts/show/$1'
    Note that urls should be lowercase if they are going to a controller method. If you want to add routes programmatically then you can check out the following file for pointers: /applications/dashboard/models/class.vanilla1importmodel.php
Sign In or Register to comment.