Recently I had a website that was getting hammered with traffic. Every hit on the website requires multiple MySQL SELECT statements. While SELECTs are typically quite fast, the database in question has several million records. Upgrading hardware isn’t an option for this website right now, and disabling the account is far from the best solution. The situation demanded a way to set a hard limit on MySQL requests for an individual user account.

Continue reading

Once in a while you might run into a suspicious IP address accessing your website. Maybe it’s doing something funny like probing for vulnerabilities, or just spamming the heck out of your server. Being a responsible webmaster, you decide to ban the IP address from your server completely – but how? Using Apache Web server it’s easy to ban a single IP address, ban multiple IP addresses or ban an entire IP range using the .htaccess file.

Continue reading

Most websites have both a www and non-www version of the domain name, but typically they both show the same thing. If you’re concerned about how search engines are viewing your website, or just want to maintain a consistent URL for all users, you can automatically redirect visitors to the non-www version of your domain name (and vice versa).

Continue reading