# Deploy this folder as the document root of api.shopnobookshouse.com, under /api (public_html/api).
Options -Indexes
<IfModule mod_rewrite.c>
  RewriteEngine On
  # HTTPS + no-www, single hop
  RewriteCond %{HTTPS} off [OR]
  RewriteCond %{HTTP_HOST} ^www\. [NC]
  RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
  RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301,NE]
  # Uploads are served directly
  RewriteRule ^uploads/ - [L]
  # Block internals
  RewriteRule ^(config|config\.sample|db|setup-code)\.php$ - [F,L]
  RewriteRule ^(install\.lock|\.env)$ - [F,L]
  RewriteRule ^(lib|routes|seo|cache|vendor|backups|migrations|tests|logs|docs)(/|$) - [F,L]
  RewriteRule \.(sql|md|log)$ - [F,L]
  RewriteRule ^error_log$ - [F,L]
  # Everything else -> front controller
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [L,QSA]
</IfModule>
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/json application/xml text/plain application/rss+xml
</IfModule>
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
</IfModule>
