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.

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

How to get full URL in 2.4

Go to End

3 Posts   3107 Views


Community Member, 103 Posts

21 September 2010 at 8:02am

Hopefully this is an easy one that I just can't seem to find...

If you are using hierarchical urls in 2.4 what function(s) would you use to get the full path. For example if you have how would return the full path. I've been looking at Director functions, but I can only get them to return the beginning and the end of the full URL i.e. or child/grandchild. I was using baseurl and urlParams respectively. What simple thing am I missing?--I want to be able to redirect to with Director::redirect()

Thanks in advance!



Community Member, 473 Posts

21 September 2010 at 8:47am

If you've got the page already, $page->Link(), otherwise SiteTree:get_by_link('insert-page-here')->Link(), however that'll only work if 'insert-page-here' is a unique URLSegment.


Community Member, 103 Posts

21 September 2010 at 9:34am


SiteTree:get_by_link('insert-page-here')->Link() was exactly what I was looking for.