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:

Customising the CMS /

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

Stop a page in the SiteTree from being viewable on front end

Go to End

2 Posts   770 Views


Community Member, 31 Posts

28 February 2012 at 1:00am

Hey guys,

I have a page which loads content from a series of child pages. I've set the child pages to hidden so they don't appear in the menu or sitemap. But I want to stop them from dispalying if you go direct to the URL of the child page.

I've tried 301 redirects using the Link Mapping module and also via .htaccess but neither seem to override the CMS functionality.

Is there anything I can put in the controller or page class to stop it from being displayed on the front end when requrested.




Forum Moderator, 5523 Posts

29 February 2012 at 12:54am

Just create a 301 redirect in the init() method for the controller. Init is run everytime the controller is used. For instance, the below will redirect to the parent page.

class SomeHiddenPage_Controller extends Page_Controller {

function init() {