There're plenty of methods, some of them are:
- first of all to host website on a secure web server,
- firewall and mod_security rules,
- make website with the latest PHP (or other language) code, which is properly sanitized,
- if WordPress, there're plenty of firewall and security plugins...