Timothy's Dev Stuff

A collection of code snippets and other developer things.

Block Website Access with .htaccess

This can be done via the file manager in cpanel or FTP. You can edit the .htaccess file directly, otherwise make a backup and create a new one. If creating a new one, I typically rename .htaccess to .htaccess.bak then create a new .htaccess file. Add the following to the top of the file:

order deny, allow
deny from all
The order deny, allow line tells it which order to parse the next commands. The next, deny from all tells it to deny access from all. If needed, an “allow from x.x.x.x” can be used to specify an IP address to allow traffic from, where “x.x.x.x” is replaced with the IP address.