How to redirect users to a particular page after login in MediaWiki
By default, when a user logs into their account they are redirected back to the same page from which they came (i.e. the page they were viewing when clicking the link for logging in). If you want to, you can select a particular page to which all users will be redirected after they log into their account, no matter from which page they logged in.
To do this, you have to add the variable $wgRedirectOnLogin with the name of the specific page to the LocalSettings.php file of your MediaWiki. For instance, if you add the following on a new line at the end of LocalSettings.php:
$wgRedirectOnLogin = "Main Page";
then users will be redirected to the Main Page (the homepage) of your site. If the name of the page consists of more than one word, you don't have to separate them with underscores; you can simply use spaces. If the page belongs to a namespace other than the main one, you should include it in name that you put in the line in LocalSettings.php. For instance:
$wgRedirectOnLogin = "Special:Preferences";
will redirect the user to the page that displays the account options of the user; the page is part of the Special namespace. If you're not sure what the exact name of the page is, and to which namespace it belongs, you can open it on the site and use its URL address for reference.
The LocalSettings.php file that you have to modify to achieve this can be found in the root MediaWiki folder on your MediaWiki hosting account. Assuming that the application is installed directly in the public_html directory on the account, then the path to the file on the account in relation to that directory will be public_html/LocalSettings.php. One way for HostKnox customers to edit files directly on the account is with the File manager of the Pixie control panel. An alternative method is to download the file on your local computer, edit it with a text editor (e.g. Notepad ++), then upload it back overwriting the old file.
Was this answer helpful?
- How to disable and enable the function for storing uploaded files in subfolders in MediaWiki
- How to prevent users from viewing pages in MediaWiki
- How to select the default namespaces to be searched by the search function in MediaWiki
- How to make CSS modifications in MediaWiki
- How to change the font style and background color of the site notice in MediaWiki