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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

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

nestedurls - upgrade to 2.4.0 breaks old url schema - (possible bug and solution)

Go to End

12 Posts   2925 Views


Community Member, 9 Posts

11 May 2010 at 7:16am

Edited: 11/05/2010 7:19am

i upgraded a site to 2.4.0 final and enabledSiteTree::enable_nested_urls(); in my config:
The old 2.3.x non nested urls for nested pages stopped working. While the changelog describes there being a fallback which rewrites the old urlsegment tot the new nested link via 301 header. While in previous beta/ rc of 2.4.0 this used to work just fine.

i traced it back to function 'find_old_page' in ModelasController.php

	if(SiteTree::nested_urls()) {
			$pages = DataObject::get(
		                "\"URLSegment\" = '$URLSegment'" . ((SiteTree::nested_urls()) ? ' AND "ParentID" = ' . (int)$parentID : '')

			if($pages && $pages->Count() == 1) return $pages->First();

isn't this non functional as there's an if statement checking for SiteTree::nested_urls() while later on a ParentID is always needed as this second check is by default true based on the previous mentioned if statement?
shouldn't the line at read
"\"URLSegment\" = '$URLSegment'" . (($parentID) ? ' AND "ParentID" = ' . (int)$parentID : '')

or could parentID be omitted completely?

Is my pre 2.4.0 implementation somehow gone wrong a bit and for whatever reason not providing a valid parentid to the function here or is this a bug which crawled in at the last minute?

hope this helps...
as a very important sidenote: thanks for 2.4.0 - it looks way way way great!


Forum Moderator, 801 Posts

11 May 2010 at 8:49pm

Sam has done some fixes to branches/2.4 regarding this:

Can you check out from subversion and see if that works for you? See


Community Member, 9 Posts

11 May 2010 at 9:00pm

works like a charm! great work!
damn, i overlooked that one in the open/closed ticketslist. sorry.
i used the download package instead of the stable branch. will checkout svn from now on.


Community Member, 110 Posts

13 May 2010 at 12:22am

Hi there,

Sorry that i use your post for my own question but i'm not really sure if i have the same issue...

'Till SS 2.3.7. i had no problems but now with 2.4 my URL's aren't working.

This code worked fine and returned a link with my videoID eg. ..../series/1
i was happy wit that, now it still returns the link, but can't find the page.

---------- code --------

public function getIndividualVideo(){

if($URLAction = Director::URLParam('Action')){

$VideoID = Convert::raw2xml($URLAction);

if(is_numeric($VideoID )){
return DataObject::get_by_id('Video', $VideoID);


----------------- end of code ---------

What happend? Can someone please help me out ?
Tx everybody


Forum Moderator, 801 Posts

13 May 2010 at 8:33am

Hm, I've added a unittest for Director::urlParam(), seems to work as expected in 2.4:


Community Member, 110 Posts

14 May 2010 at 2:57am

Yes Ingo, i'm sorry...I wasn't verry clear. The link is returned, that's not the problem. but it won't go to the right page, and it does in SS


Community Member, 32 Posts

14 May 2010 at 11:32am

Stefdv i have the same problem


Forum Moderator, 801 Posts

14 May 2010 at 2:05pm

Do you have any custom director rules? If yes, please paste them here.
You mentioned the URL "series/1" - is that connected to a SiteTree/Page record?
E.g. "mypage/series/1" ?

Director::URLParam('Action') is not the correct way to get this stuff any more,
every controller has a SS_HTTPRequest object for this now.
Use $this->request->param('Action') instead.

To retrieve the URLSegment of a page, use $myPage->Link()/AbsoluteLink() instead.

Go to Top