# Akarya static site — Apache config for the cPanel production host.
#
# The static export (`npm run build:static`) cannot run the redirects() and
# headers() defined in next.config.ts, so they are reproduced here. Keep this
# file in sync with next.config.ts. Next copies public/ into out/ at build time
# and the deploy workflow also force-copies it, so this ships to the doc root.

# Serve /about/ from /about/index.html without content negotiation guesswork.
Options -MultiViews
DirectoryIndex index.html

# --- Security headers (mirror securityHeaders in next.config.ts) ---
<IfModule mod_headers.c>
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
  Header always set Cross-Origin-Opener-Policy "same-origin"
</IfModule>

# --- Permanent redirects (mirror redirects() in next.config.ts) ---
<IfModule mod_rewrite.c>
  RewriteEngine On

  RewriteRule ^case-studies/?$                        /success-stories/ [R=301,L]
  RewriteRule ^case-studies/(.+?)/?$                   /success-stories/$1/ [R=301,L]
  RewriteRule ^id/case-studies/?$                      /id/success-stories/ [R=301,L]
  RewriteRule ^id/case-studies/(.+?)/?$                /id/success-stories/$1/ [R=301,L]

  RewriteRule ^resources/?$                            /about/ [R=301,L]
  RewriteRule ^id/resources/?$                         /id/about/ [R=301,L]

  RewriteRule ^contact/?$                              /talk-to-akarya/ [R=301,L]
  RewriteRule ^id/contact/?$                           /id/talk-to-akarya/ [R=301,L]

  RewriteRule ^partners/?$                             / [R=301,L]
  RewriteRule ^id/partners/?$                          /id/ [R=301,L]

  RewriteRule ^industries/corporate-commercial/?$      /industries/enterprise/ [R=301,L]
  RewriteRule ^id/industries/corporate-commercial/?$   /id/industries/enterprise/ [R=301,L]

  RewriteRule ^industries/hospitality/?$              /industries/hospitality-commercial/ [R=301,L]
  RewriteRule ^id/industries/hospitality/?$           /id/industries/hospitality-commercial/ [R=301,L]
</IfModule>

# Static export's 404 page.
ErrorDocument 404 /404.html
