.htaccess 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. <FilesMatch "(?i)\.(tpl|ini|log)$">
  14. Require all denied
  15. </FilesMatch>
  16. # Allow Robots.txt to pass through
  17. RewriteRule ^robots.txt - [L]
  18. RewriteCond %{REQUEST_URI} !^(/\.well-known)
  19. RewriteCond %{QUERY_STRING} ^route=common/home$
  20. RewriteCond %{REQUEST_METHOD} !^POST$
  21. RewriteRule ^index\.php$ http://%{HTTP_HOST}? [R=301,L]
  22. # ── Block all other dotfiles ───────────────────────────────────────────────
  23. RewriteRule (?:^|/)\. - [F,L]
  24. # ── www → non-www (301) ────────────────────────────────────────────────────
  25. RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  26. RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
  27. # ── Pass existing files and directories directly ─────────────────────────────
  28. RewriteCond %{REQUEST_FILENAME} -f [OR]
  29. RewriteCond %{REQUEST_FILENAME} -d
  30. RewriteRule ^ - [L]
  31. # ── Pass dashboard, login, controllers and other migrated paths directly ──────
  32. # (prevents the modX vhost catch-all from intercepting these requests)
  33. RewriteRule ^(dashboard|login|controllers|api|components|layouts|config|lib|pdf-files|client-assets|vendor)(/|$) - [L]