# Christy Winslow Photography — Apache rules (cPanel)
Options -Indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Force HTTPS (uncomment once the SSL certificate is active in cPanel → SSL/TLS Status)
  # RewriteCond %{HTTPS} !=on
  # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  # Force non-www (uncomment if you prefer christywinslowphotography.co.za without www)
  # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  # RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]

  # Block private folders and files
  RewriteRule ^app(/|$) - [F,L]
  RewriteRule ^(\.git|\.env|composer\.(json|lock)) - [F,L]

  # Admin
  RewriteRule ^admin$ admin/ [R=301,L]

  # Everything else that isn't a real file goes to index.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ index.php [L,QSA]
</IfModule>

<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
  <FilesMatch "\.(webp|jpg|jpeg|png|gif|svg|woff2?|css|js)$">
    Header set Cache-Control "public, max-age=31536000"
  </FilesMatch>
</IfModule>

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

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
</IfModule>

<Files "install.php">
  # After installing, delete install.php. This is a safety net.
</Files>

# Same limits for servers running PHP as an Apache module (ignored elsewhere)
<IfModule mod_php.c>
  php_value upload_max_filesize 64M
  php_value post_max_size 70M
  php_value memory_limit 512M
  php_value max_execution_time 120
</IfModule>
<Files ".user.ini">
  Require all denied
</Files>
