Options -Indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    RewriteRule ^(?:private|database|docs)(?:/|$) - [F,L,NC]
    RewriteRule ^_ - [F,L]
    RewriteRule (^|/)\.(?!well-known/) - [F,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^about/?$ about.php [L,QSA]
    RewriteRule ^services/?$ services.php [L,QSA]
    RewriteRule ^portfolio/?$ portfolio.php [L,QSA]
    RewriteRule ^pricing/?$ pricing.php [L,QSA]
    RewriteRule ^blog/([a-z0-9-]+)/?$ blog.php?post=$1 [L,QSA]
    RewriteRule ^blog/?$ blog.php [L,QSA]
    RewriteRule ^faq/?$ faq.php [L,QSA]
    RewriteRule ^contact/?$ contact.php [L,QSA]
    RewriteRule ^privacy-policy/?$ privacy-policy.php [L,QSA]
    RewriteRule ^terms/?$ terms.php [L,QSA]
    RewriteRule ^sitemap\.xml$ sitemap.php [L,QSA]
    RewriteRule ^robots\.txt$ robots.php [L,QSA]
    RewriteRule ^admin/?$ admin/index.php [L,QSA]
    RewriteRule ^install/?$ install/index.php [L,QSA]
</IfModule>

<FilesMatch "\.(?:env|ini|log|sql|bak|dist|md)$">
    Require all denied
</FilesMatch>

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

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

ErrorDocument 404 /404.php
