seppzzz
seppzzz

Reputation: 229

SilverStripe 3 custom routing Wildcard

I'd like to create a custom routing covering anything to start with.

Is it possible to set a wildcard in routing?

For example http://example.com/*/show/urlsegment

I have tried many things without success.

Director::addRules(100, array(
    '*/show//$EventUrlSegment' => 'MyTest_Controller'
));

What is the right syntax to cover anything before /show?

Upvotes: 0

Views: 113

Answers (1)

Fatal Error
Fatal Error

Reputation: 1024

In Silverstripe 3.* you should use the yaml file, found in the _config folder. You can define your wildcard by using $ like you did with EventUrlSegment

Director:
  rules:
    '$Action/show/$EventUrlSegment' : 'MyTest_Controller'

Upvotes: 1

Related Questions