Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How to set a custom URL route to lowest priority?


Go to End


2 Posts   1527 Views

Avatar
sonet

Community Member, 33 Posts

19 November 2012 at 7:33pm

Edited: 20/11/2012 3:16am

I am trying to implement clean urls with an variable at the top level (without having a controller action in the URL)
ex. instead of http://domain.com/cont_action/MyVar having just http://domain.com/MyVar.

The route below works, but it triggers before everything else. How can I specify my custom route to be the last one that is being checked (lowest priority even after the SiteTree)?

---
Name: approutes
After:
 - 'framework/routes#rootroutes'
 - 'framework/routes#coreroutes'
 - 'framework/routes#modelascontrollerroutes'
---
Director:
  rules:
    '$MyVar': 'AppController'

Avatar
sonet

Community Member, 33 Posts

20 November 2012 at 11:12am

Is a custom handleRequest() override my only option? Anyone?