Last Updated: August 13, 2016
· cleggypdc

Freelancers, prevent seo folks going nuts at you!

This is a tip for developers out there who don't use their local machine or VM for development and instead use a VPS / cloud based server which is open to anyone, including google, which if your project is a wordpress site will probably get indexed before you remember to turn off the pinging!

Insert this code into the default <Directory> block in your httpd.conf file. This will block access to any of your server's sites including virtual hosts and place a nice no index header in all your responses. You'll now require a password to access any sites on this server too

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Header set X-Robots-Tag "noindex, nofollow"
    AuthType Basic
    AuthName "Development Server"
    AuthUserFile /var/www/auth/.htpasswd
    Require valid-user

Then create a .htpasswd file in /var/www/auth (create that folder too or place elsewhere if you wish)

Use this link to easily generate users for the .htpasswd file: