Manual:$wgWhitelistRead

From MediaWiki.org
Jump to: navigation, search
User Access: $wgWhitelistRead
Pages anonymous user may see.
Introduced in version: 1.1.0
Removed in version: still in use
Allowed values: Array of page names, or false
Default value: false

Other settings: Alphabetical | By Function


Details[edit | edit source]

If a group of users is blocked from viewing the wiki by using the $wgGroupPermissions setting...

 $wgGroupPermissions[...]['read'] = false;

...you may still want them to be able to view certain key pages, in particular the login page! This setting holds an array of page names that all users are allowed to view, regardless of their group permissions.

A recommended minimum is as follows:

  • until 1.16.x
 $wgWhitelistRead = array( "Main Page", "Special:UserLogin", "Special:UserLogout", "-", "MediaWiki:Common.css" );
"-" is a special page that loads user CSS/JS customizations
  • starting with 1.17.0
 $wgWhitelistRead = array( "Main Page", "Special:UserLogin", "Special:UserLogout", "MediaWiki:Common.css" );
  • starting with 1.18.0
 $wgWhitelistRead = array( "Main Page", "Special:UserLogin", "Special:UserLogout", "Special:PasswordReset", "MediaWiki:Common.css" );
"Main Page" above uses spaces instead of underscores between words

This allows everyone to view the home page and the login screen. You may also want to include other pages such as help/about/contact pages.


With r105428 Special:PasswordReset is always whitelisted just like Special:UserLogin and Special:ChangePassword.


Warning Warning: If you are using a content language other than English, you may need to use the translated special page names instead of their English names

Examples[edit | edit source]

Anonymous users can only view: Special:Userlogin[edit | edit source]

Anonymous users cannot read or edit any other page, but can still create accounts:

$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['*']['edit'] = false;
$wgWhitelistRead = array ("Special:Userlogin");

To additionally block account creation by anonymous users, add the following line:

$wgGroupPermissions['*']['createaccount'] = false;

With anonymous account creation disabled, sysops will need to create accounts for new users manually (or a LDAP extension is used for authentication)

Language: English  • 日本語