RewriteEngine On

# 1. Handle Wildcard Subdomains
# Map {slug}.my.ziteo.in to /store/index.php
RewriteCond %{HTTP_HOST} ^([a-z0-9-]+)\.my\.ziteo\.in$ [NC]
RewriteCond %{REQUEST_URI} !^/store/ [NC]
RewriteCond %{REQUEST_URI} !^/uploads/ [NC]
RewriteRule ^(.*)$ /store/$1 [L]

# 2. General HTTPS Redirect (Optional, recommended for production)
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# 3. Protect Sensitive Files
<FilesMatch "(^\.|\.(sql|log|ini|md)$)">
    Order allow,deny
    Deny from all
</FilesMatch>

# 4. Prevent Directory Listing
Options -Indexes

# 5. PHP Settings
php_value upload_max_filesize 5M
php_value post_max_size 5M
