# Orlando PR Badge System - URL rewriting
# Maps  orlandopr.com/businessname  ->  profile.php?slug=businessname
# Real files and folders are served normally, so admin/, assets/, etc still work.

<IfModule mod_rewrite.c>
  RewriteEngine On

  # If you installed this in a SUBFOLDER, uncomment and set it, e.g.:
  # RewriteBase /badges/

  # Do not rewrite if the request is an existing file or directory
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]

  # Send a single path segment to the profile page as ?slug=
  RewriteRule ^([A-Za-z0-9][A-Za-z0-9\-]*)/?$ profile.php?slug=$1 [L,QSA]
</IfModule>

# Protect sensitive files
<FilesMatch "^(config\.php)$">
  Require all denied
</FilesMatch>
