RewriteEngine On

# Block access to .htm and .json files and working folders
RewriteRule \.(htm|json)$ - [F,L]
RewriteRule ^.*/?(scrap-cache|scrap-logs)(/|$) - [F,L]

# Let Apache handle images and other files directly (whether they exist or not)
RewriteCond %{REQUEST_URI} \.(jpg|jpeg|png|gif|webp|svg|ico|avif|css|js)$ [NC]
RewriteRule ^ - [L]

# Route everything else that is not a real file,
# and all managed file types, to the PHP CMS
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} \.(pdf|zip)$ [NC]
RewriteRule ^(.*)$ index.php?p=$1 [QSA,L]
