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

Hiding a site that's in development

Go to End

5 Posts   1599 Views


Community Member, 14 Posts

22 April 2011 at 3:20am

Hi, I'm sure someone must know this.

I want to hide a site that's in development from search engines and users while the site is in developer mode.

Is there a way to redirect any visitors to a given page when the environment type = dev & they aren't logged in?

I've tried this in _config.php in /mysite/

if (Director::isDev() & !Member::currentUserID()) {

No worky.



Forum Moderator, 1848 Posts

22 April 2011 at 4:58am

you could put a htaccess authentication...

but with silverstripe you could try to wrapping the contents of with...

<% if CurrentMember %>


<% end_if %>


Forum Moderator, 5521 Posts

22 April 2011 at 5:26pm

We use BasicAuth::protect_entire_site(); when in test mode. This requires a username and password from your SS database to see the site.


Community Member, 14 Posts

23 April 2011 at 1:02am

Thanks willr, that's a heavy duty way of doing it.

Just noticed this though, setting the access level on the root of the site to logged in users only sorts my issue. Permissions inherit all the way down, also means we can set a single page access for a client to check out, and make the others inaccessible.

Thanks swaiba, will check out the htaccess method.


Forum Moderator, 1203 Posts

25 April 2011 at 10:14pm

Nice! :-) 'protect_entire_site' - totally new to me, wonder how I could have missed it all this time...