How to Secure Your Website
- Cyber Security
- Cloudflare setup, CSRF protection, cybersecurity checklist, free website security, html site protection, HTTPS, malware removal, secure configuration, secure hosting, shopify security, SQL injection fix, SSL, WAF, web hardening, website protection, website security, wordpress security, XSS prevention
- October 23, 2025
11. Sanitize & validate all input (XSS / SQLi / OS Injection)
WordPress (free)
-
Use built-in escaping:
-
Replace direct SQL with
$wpdb->prepare(): -
Install “Wordfence Security – Free” → enables live firewall + sanitization checks.
-
Bonus: enable Cloudflare WAF → Managed Rules → OWASP → enable SQL/XSS protections.
Shopify (free)
-
Avoid unescaped Liquid: use
-
Never use
{{ ... | raw }}in templates. -
Add Cloudflare free WAF to block injection patterns on your storefront domain.
Static HTML (no CMS)
-
Validate forms in JS before POST:
-
Server-side (PHP example):
-
Use ModSecurity OWASP Core Rule Set (CRS) free module on Apache/Nginx.
12. Validate output encoding / CSP (Content Security Policy)
WordPress
-
Add CSP headers in
.htaccess: -
Or use “HTTP Headers” plugin → Security → enable CSP, X-XSS-Protection, X-Content-Type-Options.
-
Sanitize template variables using
esc_attr(),esc_html().
Shopify
-
Add
<meta http-equiv="Content-Security-Policy" content="default-src 'self' https://cdn.shopify.com https://*.shopifycdn.com;">insidetheme.liquidhead. -
Escape all variables with
| escapefilter. -
Avoid inline JS; load from assets.
Static HTML
-
Add headers in Apache or Nginx:
-
Run Mozilla Observatory scan (free) → https://observatory.mozilla.org to confirm grade ≥ A.
13. Secure file uploads (CWE-434 / CWE-22 Path Traversal)
WordPress
-
If file uploads are needed, install “File Upload Types by WPForms” → whitelist safe MIME types only.
-
Prevent PHP execution in uploads:
-
Create
/wp-content/uploads/.htaccess:
-
-
Validate filename before saving:
-
Use plugin “MalCare Free” or Wordfence → scans uploaded malware.
Shopify
-
Files uploaded by customers go to Shopify CDN — already validated.
-
For custom forms, limit accepted file types:
-
Cloudflare WAF: block requests with multipart uploads > 10 MB or double extensions (
.php.jpg).
Static HTML
-
In upload handler (PHP/Python):
-
Apache
.htaccess: -
Cloudflare WAF: block
.php,.exe,.sh,.pl,.cgiuploads.
14. CSRF (Cross-Site Request Forgery) Protection
WordPress
-
Use nonces (built-in anti-CSRF tokens):
Verify on submit:
-
Many plugins include this automatically (check forms).
Shopify
-
All admin & customer POST routes include authenticity tokens automatically.
-
For custom forms, use:
-
Cloudflare free Turnstile CAPTCHA (replace reCAPTCHA):
-
https://dash.cloudflare.com → Turnstile → Create site key → Add widget to forms.
-
Static HTML
-
Add hidden CSRF token:
Server validation:
-
Or include Cloudflare Turnstile or hCaptcha free widget on every POST form.
15. Prevent path traversal / directory exposure
WordPress
-
In
.htaccess: -
Disable directory browsing.
-
Validate file paths in custom code:
Shopify
-
No direct file-system access → safe by design.
-
Review theme files; remove
/templates/customers/*.liquidnot used. -
Avoid using
asset_urlto reference user-controlled names.
Static HTML
-
Apache:
-
Nginx:
-
Don’t let uploaders specify folder paths — strip
../.
Leave Your Comment Here
You must be logged in to post a comment.
