21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1656 Views |
-
Director::addRules() mystery

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 -
Re: Director::addRules() mystery

5 March 2011 at 10:02am
you have...
SiteTree::enable_nested_urls();
... in your _config.php?
-
Re: Director::addRules() mystery

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 -
Re: Director::addRules() mystery

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.
| 1656 Views | ||
|
Page:
1
|
Go to Top |



