.htaccess 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 .php files directly (prevent vhost modX routing) ─────────
  28. RewriteCond %{REQUEST_FILENAME} -f
  29. RewriteRule \.php$ - [L]