RewriteEngine On

# ── Static Pages ──
RewriteRule ^terms$ terms.php [L,QSA]
RewriteRule ^privacy$ privacy.php [L,QSA]
RewriteRule ^copyright$ copyright.php [L,QSA]
RewriteRule ^contact$ contact.php [L,QSA]

# ── Folder View ──
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^d/([a-zA-Z0-9_-]+)$ index.php?folder=$1 [L,QSA]

# ── File Download / Stream ──
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^f/([a-zA-Z0-9_-]+)$ download.php?id=$1 [L,QSA]