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:

Archive /

Our old forums are still available as a read-only archive.

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

Hierarchical / Semantic URLs

Go to End

9 Posts   4471 Views


Community Member, 1 Post

17 November 2007 at 9:45pm

I have recently discovered Silverstripe and love it, especially how uncomplicated it is. However, at this point in time, I won't be using it due to what I consider a glaring oversight - the inability to have hierarchical / semantic URLs.


I'm sure I don't need to go in to how important hierarchical / semantic URLs are, especially for user experience (remembering a URL, knowing where you are in a site) and for SEO, however I will express my surprise and disappointment at the lack of support.

I'm sure the developers will be able to justify why they don't support hierarchical / semantic URLs but rather than hiding behind some technical reason I encourage you to take a positive view and look to overcome any of the challenges and to address this issue.

Given how important hierarchical / semantic URLs are, I'm sure that I'm not the only one that would be seeking such functionality nor the only one not using Silverstripe specifically for this reason.

Keep up the good work.


Forum Moderator, 5523 Posts

18 November 2007 at 12:01am

You arent the only one making this request! This request has been brought up many many times and you might like to look at Sams post on the second page sums up pretty well.

And It does make larger sites harder to handle without hierarchical URL eg knowing where you are on the site but really this can be offset some way by good navigation structure (showing current and section styles Thats why we have $LinkingMode) and breadcrumbs.

As more users are likely or just as likely to click/visual on page cues to get where they want rather then edit/look at the url. Its the best you can do at the moment till whenever multi level URL structures become reality!


Community Member, 501 Posts

18 November 2007 at 9:19am

Actually I'm really starting to love how SS handles it: URLSegment/Action/ID or specified otherwise.

In that way it is possible to do something like category/subcategory/name. You just have to make specific methods on your controller. Semantic urls is something that you completely control yourself in this way.


Community Member, 105 Posts

25 January 2008 at 3:38pm

dio5, could you please post an example of what you mean, with the controller?


Community Member, 470 Posts

26 January 2008 at 4:55am

Yes, I would love to see an example.

I just posted a topic last night with a few questions, and this was one of them.

I've read the reasoning behind it, and don't expect it built into the core any time soon, but this would be a feature I'd _love_ to have.


Forum Moderator, 922 Posts

27 January 2008 at 1:31pm

Edited: 27/01/2008 1:36pm

It's actually relatively simple.

As an example, we have a URL like - semantically this means we want we might want to show the content for this page from the page ID 5, instead of the current page content.

We can do something like this, on our controller class:

function show() {
	$params = Director::urlParams();
	if($params['ID'] && is_numeric($params['ID'])) {
		$page = DataObject::get_by_id('Page', (int)$params['ID']);
		if($page) {
			return array(
				'Content' => $page->Content
	Director::redirect($this->Link() . 'show/' . $this->ID);

The above example is extremely simple. All it does is swap the Content field on this page with a different one, based on the ID given in the URL. So, if you go to it will show the Content field from page ID 10. If you just go to without the ID, then it redirects to the show action with the current page ID.

As you can see, it's pretty flexible, so you can implement methods like show() edit() and delete() on your web apps, for example.

Hope this helps!



Community Member, 105 Posts

29 January 2008 at 1:59pm

I am still working through this, but I think each step should be explained.

$Director::urlParams() returns an array with the following:


As far as I can tell, a URI such as gets translated into


This is meant for web apps whereby you can control functions from the URI. So it calls up the content for 'Artists', looks for a function called 'show' and sends it the parameters, '5' and '2'.

However, I am still working through how this can help with It appears from first glance that translating between the two may get ugly as it is does not appear to be meant to translate legacy URI schemas.

Please correct me if my understanding is incorrect.


Community Member, 54 Posts

17 July 2008 at 10:20am

maybe you can use this:

i have been talking with some of the best guys in the irc channel and gave me this patch to make hierachical semantic urls to work!

Go to Top