# Royal Templates API - Apache Configuration

# Enable Rewrite
RewriteEngine On

# Set base path
RewriteBase /templates/v1/

# Route all requests to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]

# Security headers
<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "DENY"
    Header set X-XSS-Protection "1; mode=block"
</IfModule>

# Protect sensitive directories
<FilesMatch "^\.">
    Order allow,deny
    Deny from all
</FilesMatch>

# Protect cache and logs directories
RedirectMatch 403 ^/templates/v1/(cache|logs)/.*$

# Disable directory listing
Options -Indexes
