How to Make a Hidden Private Site Using Drupal 9

If you want to make an online website using Drupal 9 and hide it from unauthorized users to only let you or users that have a username and password access the content of that site, this article has a step by step guide for doing so.

Using this tutorial you can not only hide the website’s content from unauthorized users but also hide it from search engines; so you can be sure that your content is not visible to both visitors and search engines.

To do so, you will have to install a couple of modules. We have explained the installation and configuring process of them one by one.

1. Require Login Module

It is a module to limit the access of unauthorized users to your site’s content. This module can be configured easily and only lets authorized users access your site. 

To install this module, as always, you need to go to the admin panel and go to the Manage -> Extend section. Click on the Add new module button.

Click on Add new Module
Click on Add new Module

Now copy the link of the .zip or .tar.gz file and paste it to the URL section and click continue; the module will be installed within seconds.

Now click on Enable newly added module.

Click on newly added module
Click on newly added module

Now from the module’s list, find the Require Login module, mark it and click on Install button to enable this module.

After enabling that, return back to the module’s list and click on the Configurations of Require Login module. You can change the settings of this module; for example, set the default message that is displayed on your website to “access to this page is prohibited.

Configurations of Require Module
Configurations of Require Module

After making any changes, click on the Save configuration button.

Now you have disabled accessing unauthorized users to the content of your Drupal website successfully. To test it, enter your website using a browser that you have not logged in. You can see the message indicating you must enter login information to have access to the site as below.

As you can see, anyone can still see the website. If you need to go one step further and show the visitors a username and password screen only, you need to install another module to expand the limitation of accessing to your Drupal site.

2. Shield Module

The Shield module makes a shield for your Drupal site with Apache authentication. It hides the site if the user does not know the username and password to access it.

Go to the module’s page and install the module and enable it as previously explained. The steps to install this module are similar to the previous module and you can follow those steps for this module too.

After installing it, for enabling it, from the module’s list, search for the PHP Authentication shield, mark it and install it.

Then from the module’s list, go to the configure of the PHP Authentication shield module.

Click on Configure
Click on Configure

You can change different aspects of this module. You should choose a user and password for accessing your site. You can also set the messages and other settings for showing.

Now try to enter your site , you will see only a small window telling you that you must enter user and password to enter this website.

Authentication Required for Entering Site
Authentication Required for Entering Site

Until now, you have disabled access to your site and you are done; but if you are going to limit access of search engines on your website, you can install another module too.

3. Robots Txt Module

You can surely change robotx.txt file anytime you want, but this module generates the robots.txt file dynamically and gives you the chance to edit it from the admin panel of your Drupal Site.

Install the module as explained previously and enable. To change the settings of this module go to the admin panel, go to the Manage -> Configuration section and from the Search and metadata section, click on RobotsTxt.

Now you can edit the content of robots.txt file anyhow you want without needing to access the FTP of the site for downloading, editing and reuploading robots.txt file. You can limit the search engines from crawling your site here by using the appropriate rules for changing robots.txt file.

Editing the Content of Robots.txt
Editing the Content of Robots.txt
You might also like
Leave a comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More