Support

Admin Tools

#41019 Add extra security to the root directory of my development subdomains

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
5.1.2
PHP version
8.3
Admin Tools version
7.5.4

Latest post by nicholas on Friday, 23 August 2024 01:36 CDT

iorbita

Hello,
I've been advised to add extra security to the root directory of my development subdomains (test sites) to prevent search engines from indexing these pages. Unfortunately, some development pages occasionally appear in search results.

Apparently, simply using noindex,nofollow meta tags isn't sufficient.

Question:

If I use an .htpasswd file at the root of the development site for password protection, do I still need AdminTools?

Here's what I did:

- I accessed to .htaccess file.
- I added the following lines:

AuthType Basic
AuthName "Restricted Area"
AuthUserFile /home/User/PathToYourFolder/.htpasswdd
Require valid-user

Note: I replaced "User" and "PathToYourFolder" with my actual username and the path to the folder containing my .htpasswd file.

- I created an .htpasswd file.
- I used a tool like https://www.web2generators.com/apache-tools/htpasswd-generator to generate a username and password.
- I copied the generated code into my .htpasswd file.

While this approach works for most sites, it seems to conflict with .htaccess AdminTools file on some installations. Apparently, there might be a setting in AdminTools that prevents the .htpasswd file from functioning.

If using AdminTools offers additional benefits for development site security, I'd appreciate it if you could explain which option might be interfering with the .htpasswd file.

Many thanks,
Lorenzo

nicholas
Akeeba Staff
Manager

Why don't you just use a robots.txt file?

Also, if you want to use the .htaccess trick for restricting access to a site, you can use that code in the .htaccess Maker. Put your code in the "Code to add at the top of the file", since you want to apply the password access control before any other security check. Otherwise, you are right, the code in the .htaccess Maker might end up overriding the password access control, e.g. when trying to access an explicitly allowed media file. There is nothing else which would be in conflict.

Finally, there's the obvious point of avoiding all that using a local development server. It's a bit of a bother to set one up, but it's faster, very reliable, and you don't have to worry about search engines and malicious access while you're in the development phase. You can make mistakes which don't cost you anything more than some of your time.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

iorbita

Hi,

I would have liked to edit my first message about robots.txt file, but I was too late, apparently even robots.txt file isn't a very safe bet for robots.
Here's the answer from the developer of a well-known SEO extension for Joomla:

“Just remember that if you use noindex and robots.txt, you just have no protection at all and your development site content, or at least URLs, can appear in many search engines, including Google. “

All my sites are developed locally, but I always leave a copy on the production server when I need to run tests and/or for staging environment.

Even if I place the rule at the very beginning of the htaccess file via .htaccess Maker, access is still possible, so I don't understand why.
If I put the htaccess file only with the rule, access is not possible.

Also, my first question has not been answered: If I use an .htpasswd file at the root of the development site for password protection, do I still need AdminTools?

Thanks again,
Lorenzo

nicholas
Akeeba Staff
Manager

“Just remember that if you use noindex and robots.txt, you just have no protection at all and your development site content, or at least URLs, can appear in many search engines, including Google. “

This response lacks context. Depending on the context it can be either accurate, or completely off the mark. Also note the link I sent you is Google's own advice on how to use robots.txt, and what it does :)

The robots.txt file tells search engines to NOT crawl your site.

What that file does not do is prevent search engines from following links outside of your site, follow links from other allowed pages on your site, or remove already indexed pages.

In the context of a development site which is not linked to from any external page, is not indexed, and has a robots.txt file telling search engines to not index it the robots.txt file will be enough. In this particular context, the answer your received is wrong. In any other context, the answer you received is correct because of what I said about what robots.txt doesn't do.

Also, my first question has not been answered: If I use an .htpasswd file at the root of the development site for password protection, do I still need AdminTools?

I have a rule of not giving advice I would never follow myself, but you are asking me for exactly that.

I would only ever consider putting a staging site on a live server, and only after setting it to off-line in Global Configuration. This prevents leaking content better than any other possible method, but it also means you can never see the site as a guest.

I would never put a development site on an Internet-accessible server. By their definition, they will have to throw errors during the development process, and the errors do contain privileged information. In the rare cases where I need my dev site to be Internet accessible I use Expose, limiting the amount of time my dev site is accessible to what is absolutely necessary.

So, I will have to give advice I would never follow, for a dev/staging site I would never have in the configuration you are asking me about. The only set of conditions under which I would not totally freak out about you not using a security extension is if I knew that everything is password protected, the server allows you to use passwords over 8 characters long, and you are using a long (24+ characters), randomly generated password consisting of lowercase and uppercase letters, numbers, and punctuation.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

iorbita

Ok, thank you for all your explanations, which are always very detailed.
The most difficult thing will be choosing a working method and taking a decision. Thanks again.

nicholas
Akeeba Staff
Manager

You're welcome!

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!