.htaccess 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # @version 7.6
  2. # disable direct access to folders
  3. Options -Indexes
  4. # Follow symbolic links
  5. Options +FollowSymLinks
  6. <IfModule mod_rewrite.c>
  7. RewriteEngine On
  8. #RewriteBase /
  9. # if installed in root folder
  10. #RewriteCond %{HTTP_HOST} !^www\.
  11. #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
  12. # if installed in subfolder
  13. #RewriteCond %{HTTP_HOST} !^www\.
  14. #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/<subfolder>/$1 [R=301,L]
  15. # used to check if mod rewrite works
  16. RewriteRule ^test-mod-rewrite$ mod-rewrite.php [NC,L]
  17. # redirect all requests to index.php
  18. RewriteCond %{REQUEST_FILENAME} -s [OR]
  19. RewriteCond %{REQUEST_FILENAME} -l [OR]
  20. RewriteCond %{REQUEST_FILENAME} -d
  21. RewriteRule ^.*$ - [NC,L]
  22. RewriteRule ^.*$ index.php [NC,L]
  23. </IfModule>
  24. # 7 DAYS
  25. <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
  26. Header set Cache-Control "max-age=604800, public"
  27. </FilesMatch>
  28. # 1 DAY - will prohibit the abuse on generating the sitemap xml file
  29. <FilesMatch "\.(xml|txt)$">
  30. Header set Cache-Control "max-age=86400, public, must-revalidate"
  31. </FilesMatch>
  32. # using apache mod_deflate for compressing static content
  33. <IfModule mod_deflate.c>
  34. AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
  35. </IfModule>