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.

General Questions /

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

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

How to set a custom URL route to lowest priority?


Reply


2 Posts   535 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?