Extension:NamespaceReadRestrict

What can this extension do?
It can allow reading of pages in particular namespaces, but not others.

Installation
Add this to your LocalSettings.php file:
 * Copy the code at Extension:NamespaceReadRestrict into a new file, /extensions/NamespaceReadRestrict/NamespaceReadRestrict.php
 * Copy the code at Extension:NamespaceReadRestrict into a new file, /extensions/NamespaceReadRestrict/NamespaceReadRestrict.i18n.magic.php

Configuration
In accordance with the instructions at Manual:Preventing access, abolish the ability of non-logged-in users to read, edit or create accounts on your wiki and initialize the $wgWhitelistRead array (it must be initialized, even if it's empty, in order for this extension to work) by adding to your LocalSettings.php file the following:

Also add to LocalSettings.php, after the  line, this configuration setting specifying what namespaces are okay for non-logged-in users to read. E.g. in this example, non-logged-in users will only be allowed to read pages in namespace 0, the main namespace. See Manual:Namespace and Manual:Using custom namespaces.

Parser function
There is a parser function,. If you also have Extension:ParserFunctions installed, then you can use this to, for example, give logged-in users and non-logged-in users different main pages. To do that, you would create pages "Template:Private main page" and "Template:Public main page" and then replace the content of "Main Page" with: