21493 Posts in 5784 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1039 Views |
-
Hiding a site that's in development

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()) {
Director::redirect(Director::baseURL());
}No worky.
Thanks.
-
Re: Hiding a site that's in development

22 April 2011 at 4:58am
you could put a htaccess authentication...
http://www.htaccesstools.com/htaccess-authentication/but with silverstripe you could try to wrapping the contents of Page.ss with...
<% if CurrentMember %>
...
<% end_if %>
-
Re: Hiding a site that's in development

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.
-
Re: Hiding a site that's in development

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.
-
Re: Hiding a site that's in development

25 April 2011 at 10:14pm
Nice!
'protect_entire_site' - totally new to me, wonder how I could have missed it all this time...
| 1039 Views | ||
|
Page:
1
|
Go to Top |



