Hide WordPress staging sites from the internet
1 min read

Hide WordPress staging sites from the internet

There are many approaches, I use the Restricted Site Access WordPress plugin and set the constant in the environment I am working in. The way this would work in bedrock is to add the following in the staging environment (config/environment/staging.php)

define( 'RSA_FORCE_RESTRICTION', true );

In my production environment (config/environment/production.php) I set the following:

define( 'RSA_FORBID_RESTRICTION', true );

More (but not much more) about this in the FAQ of the plugin.

It's important to remember this, also from the FAQ:

Restricted Site Access does not block access to your, so direct links to files in your media and uploads folder (for instance) are not blocked.

A lot more can be said (and done) about protecting your staging site, but this — to me — is a good first step and a bit more reliable then merely asking google not to index the site and hoping nobody guesses your staging domain.