# Bait Alamer - URL Routing and Security

# Enable RewriteEngine
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /Bait-alamer/
    
    # Clean URL: /Alnublaa -> index.php (main calculator)
    RewriteRule ^Alnublaa/?$ index.php [L]
    
    # Redirect /login to main calculator
    RewriteRule ^login/?$ index.php [L,R=301]
    
    # Hide index.php from URL bar
    RewriteCond %{THE_REQUEST} /index\.php [NC]
    RewriteRule ^index\.php$ /Bait-alamer/Alnublaa [L,R=301]
</IfModule>

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

# Prevent directory listing
Options -Indexes

# Protect sensitive files
<FilesMatch "^(\.htaccess|announcements\.json|prices\.json|price_updates\.log)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>

# PHP settings
<IfModule mod_php7.c>
    php_flag display_errors Off
    php_flag log_errors On
</IfModule>
