Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

62 lines
2.1KB

  1. <IfModule mod_rewrite.c>
  2. <IfModule mod_negotiation.c>
  3. Options -MultiViews -Indexes
  4. </IfModule>
  5. RewriteEngine On
  6. # ローカル判定
  7. SetEnvIf HOST "^localhost.*$" isLocal
  8. #ステージング判定
  9. SetEnvIf HOST "^15.152.39.28$" isStaging
  10. #本番判定
  11. SetEnvIf HOST "^qrs\.hello-techno-network\.com$" isProduction
  12. # SSL強制
  13. RewriteCond %{ENV:isLocal} !-
  14. RewriteCond %{ENV:isStaging} !-
  15. RewriteCond %{HTTPS} off
  16. RewriteRule ^(.*)$ https://qrs.hello-techno-network.com/$1 [R=301,L]
  17. # ドメインアクセス強制
  18. RewriteCond %{ENV:isLocal} !-
  19. RewriteCond %{ENV:isStaging} !-
  20. RewriteCond %{HTTP_HOST} ^\d+\.\d+\.\d+\.\d+$
  21. RewriteRule ^(.*)$ https://qrs.hello-techno-network.com/$1 [R=301,L]
  22. Header unset X-Powered-By
  23. Header set "Content-Security-Policy" "default-src 'self';style-src 'self' 'unsafe-inline' fonts.googleapis.com;img-src 'self' data: api.iconify.design;font-src 'self' fonts.gstatic.com;frame-ancestors 'none';form-action 'self';connect-src 'self' https:" env=!isLocal
  24. Header set "X-Frame-Options" "deny"
  25. Header set "Cache-Control" "no-cache, no-store, must-revalidate"
  26. # Handle Authorization Header
  27. RewriteCond %{HTTP:Authorization} .
  28. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  29. # Redirect Trailing Slashes If Not A Folder...
  30. RewriteCond %{REQUEST_FILENAME} !-d
  31. RewriteCond %{REQUEST_URI} (.+)/$
  32. RewriteRule ^ %1 [L,R=301]
  33. # Send Requests To Front Controller...
  34. RewriteCond %{REQUEST_FILENAME} !-d
  35. RewriteCond %{REQUEST_FILENAME} !-f
  36. RewriteRule ^ index.php [L]
  37. # 以下、ファイルアクセス
  38. # リソース判定
  39. SetEnvIf Request_URI "^\/static\/js\/.+\.js$" isJsFile=yes
  40. SetEnvIf Request_URI "^\/static\/css\/.+\.css$" isCssFile=yes
  41. SetEnvIf Request_URI "^\/fonts\/.+$" isFontFile=yes
  42. Header set "Cache-Control" "private, no-cache" env=isJsFile
  43. Header set "Cache-Control" "private, no-cache" env=isCssFile
  44. Header set "Cache-Control" "private, no-cache" env=isFontFile
  45. Header set "X-Content-Type-Options" "nosniff"
  46. </IfModule>