Security help › Websites and servers
Website security: the essentials
What every website owner should do, whether it's WordPress, a shop, or something you built yourself.
The basics
- Use HTTPS (the padlock) everywhere, and send visitors from http to https automatically.
- Keep everything updated: the platform (WordPress, Joomla and others), every plugin and theme, and the server itself. Most hacked sites run an old plugin.
- Delete plugins and themes you don't use. Turning them off isn't enough.
- Protect the admin login: a unique password, two-step login, and limit login attempts. Don't use "admin" as the username.
- Back up the site and its database every day, keep copies somewhere else, and test that a restore works.
- Never put passwords or keys in your code or on GitHub. Keep them in environment settings, and make sure files like .env, .git and backups (.zip, .sql) can't be downloaded from the website.
- Add the security settings browsers understand (HSTS, CSP and the others). Our free outside check shows which ones you're missing.
- Protect your email name with SPF and DMARC, so scammers can't send email pretending to be you.
If you write the code
- Never build database queries by gluing text together. Use parameterised queries, so typed-in text can't become a command (SQL injection).
- Escape everything you show on a page. So nobody can slip in their own scripts (cross-site scripting).
- Check who's asking, every time. Every page and API call must check the person is logged in AND allowed to see that record.
- Limit how fast people can try. Logins, sign-ups, password resets and contact forms all need rate limits.
- Give the database user only what it needs. A website rarely needs to drop tables.
Watching for trouble
Bots try every website on the internet for .env files, .git folders, old plugins and admin pages, all day. Keep an eye on your logs, and get alerts for new admin accounts, changed files and expiring domains and certificates. The guides below go step by step.