This post has been updated to reflect changes in Moodle 4.0+
By default, Moodle’s Front page usually contains a list of available courses, news items and some Moodle blocks depending on the site’s configuration, and the default Moodle content on the page can be viewed by all the site’s visitors. Some of our clients wanted to prevent anonymous site visitors from seeing any of Moodle’s default content (eg. available Moodle courses), and asked us if it is possible to force users to log in to view Moodle content. The answer is Yes and it is actually really easy to do in Moodle.
Log into your Moodle site as an admin user, and navigate to the Site security settings option by going to
Site administration > Security > Site security settings
Tick the “Force users to login” option checkbox.
Click the “Save changes” button. Now, if you log out and try to access your Moodle site again, you will need to log in first before viewing any Moodle content.