In some cases, Websites do not allow anonymous users to access the content. Recently I did have a similar situation where I have created a custom module for it, in Drupal 8.
In the following text, I'll explain to you step by step how to create it. The module name is anonymous_redirect.
First of all, create a folder named "anonymous_redirect" in your modules folder.
Then in module root create a '.info.yml' file to define it. Name it "anonymous_redirect.info.yml".
Paste this code into it:
Next, as we will use 'event subscriber' for this module, we'll define it.
Create a file "anonymous_redirect.services.yml", again in module root, and paste the content below:
Now we need to create that event subscriber, in the module root folder. Create a folder "src", then in that newly created folder create another folder "EventSubscriber".
In "EventSubscriber" create a file, and name it "RedirectAnonymousSubscriber.php", which will be our 'event subscriber'. Paste the following content in that file:
What we did here is that we have checked if the user is not logged in and that the route name he is currently occupying is not one of the user login/password reset form - in which case it will always redirect him to the user login page.
And that's it. You can also add some other routes which will not be affected by this redirect.
Activate the module, and try it yourself.