# INKRAH CMS Compro v3a — root .htaccess
# Developed by INKRAH Web Design | Powered by INKRAH.com

Options -Indexes
<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

<FilesMatch "\.(sqlite|sqlite3|db)$">
    Require all denied
</FilesMatch>

<FilesMatch "^config\.php$">
    # Readable by PHP (require_once), but never served directly by Apache
    # in misconfigured setups — this stops a raw text/plain download.
    <IfModule mod_headers.c>
        Header set Content-Disposition "inline"
    </IfModule>
</FilesMatch>

# ---- Slug / pretty URLs --------------------------------------------------
# /page/<slug>     -> page.php?slug=<slug>
# /article/<slug>  -> article.php?slug=<slug>
# Any existing ?lang=... (or other) query string is preserved (QSA).
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^page/([A-Za-z0-9\-]+)/?$ page.php?slug=$1 [L,QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^article/([A-Za-z0-9\-]+)/?$ article.php?slug=$1 [L,QSA]
</IfModule>
