.htaccess 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # ----------------------------------------------------------------------
  2. # | 8G Firewall for Security - Do not change this part @Update 03/2024
  3. # ----------------------------------------------------------------------
  4. # 8G FIREWALL v1.5 20250927
  5. # https://perishablepress.com/8g-firewall/
  6. # 8G:[CORE]
  7. ServerSignature Off
  8. Options -Indexes
  9. RewriteEngine On
  10. RewriteBase /
  11. SetEnv TZ Australia/Hobart
  12. Options +SymLinksIfOwnerMatch
  13. # ── Allow .well-known for SSL/ACME challenges ──────────────────────────────
  14. RewriteRule ^\.well-known/ - [L]
  15. <FilesMatch "(?i)\.(tpl|ini|log)$">
  16. Require all denied
  17. </FilesMatch>
  18. # Allow Robots.txt to pass through
  19. RewriteRule ^robots.txt - [L]
  20. RewriteCond %{REQUEST_METHOD} !^POST$
  21. RewriteRule ^index\.php$ / [R=301,L]
  22. Header set X-Frame-Options "SAMEORIGIN"
  23. Header set X-Content-Type-Options "nosniff"
  24. Header set Referrer-Policy "no-referrer"
  25. Header set X-Robots-Tag "index, follow"
  26. # ── Block all other dotfiles ───────────────────────────────────────────────
  27. #RewriteRule (?:^|/)\. - [F,L]
  28. # ── www → non-www (301) ────────────────────────────────────────────────────
  29. #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  30. #RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
  31. # ── Pass existing .php files directly (prevent vhost modX routing) ─────────
  32. RewriteCond %{REQUEST_FILENAME} !-f
  33. RewriteCond %{REQUEST_FILENAME} !-d
  34. RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
  35. RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]