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

Director::addRules() mystery


Go to End


4 Posts   2941 Views

Avatar
aragonne

Community Member, 26 Posts

4 March 2011 at 11:55pm

Hi, I'm trying to define a custom rewrite rule in my _config.php:

Director::addRules(50, array(
'Feed//$Action/$LoginName/$Password/$LastModDate/$DeleteMode' => 'FeedEngine',
));

However, when I try to access the url:

http://mysite.com/Feed/Go/labcorp/abc123/1234/0

I get a "I can't handle sub-URLs of a FeedEngine object" message.

Any idea why this is happening? The Go() method does exist in the FeddEngine class (which is a subclass of Controller).

thanks,
Steve

Avatar
swaiba

Forum Moderator, 1899 Posts

5 March 2011 at 10:02am

you have...

SiteTree::enable_nested_urls();

... in your _config.php?

Avatar
aragonne

Community Member, 26 Posts

5 March 2011 at 1:05pm

Hi Swaiba,

Yes, I do have nested urls enabled.

I updated the setting above by removing the double slash after 'Feed' and the error message disappeared. I tried to find out what the double slashes mean, but I couldn't find anything in the SS docs or forum. I saw it being used in the sapphire/_config.php file and it looks like a delimiter between the url segment and the params so I copied the format.

Anybody have explanation as to what the double slashes mean?

thanks again,
Steve

Avatar
ajshort

Community Member, 244 Posts

5 March 2011 at 1:14pm

The double slashes define a shift point in the URL - basically everything before the slashes is shifted off, and the stuff after it is passed to the actual controller to handle as it sees fit. This would have meant that your controller was passed everything after "Feed" to handle. Since it then didn't have a matching rule defined in $url_handlers, it errored out.