# MCCT Instruments, React build on cPanel (Apache).
DirectoryIndex index.html
Options -Indexes
AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # Uncomment to force HTTPS once the SSL certificate is active in cPanel:
  # RewriteCond %{HTTPS} !=on
  # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  # Old mcctinstruments.com URLs -> new pages (301, keeps Google rankings)
  RewriteRule ^index\.htm$ / [R=301,L]
  RewriteRule ^about-us\.htm$ /about [R=301,L]
  RewriteRule ^contact-us\.htm$ /contact [R=301,L]
  RewriteRule ^ecatalog\.htm$ /e-catalog [R=301,L]
  RewriteRule ^dental\.html$ /products/dental [R=301,L]
  RewriteRule ^(extracting-forceps|root-elevators|diagnostic-periodontal-restorative-instruments|dental-implant-instruments|orthodontic-instruments|impression-trays|maxillofacial-surgery-instruments|hollow-ware-instruments)\.html$ /products/dental/$1 [R=301,L]

  # Real files and folders are served as they are (assets, send.php, robots.txt)
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]

  # Every other path is a React page
  RewriteRule ^ index.html [L]
</IfModule>

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json image/svg+xml text/plain
</IfModule>

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType image/x-icon "access plus 1 month"
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType text/html "access plus 0 seconds"
</IfModule>

<IfModule mod_headers.c>
  Header set X-Content-Type-Options "nosniff"
  Header set Referrer-Policy "strict-origin-when-cross-origin"
  <FilesMatch "\.(html)$">
    Header set Cache-Control "no-cache"
  </FilesMatch>
</IfModule>

# Rate limit log written by send.php
<Files ".mcct-rate.json">
  Require all denied
</Files>
