# Vue Router HTML5 History Mode Support
# Place this file in the web root (public_html) on your server
# This ensures all routes are handled by Vue Router

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Vue SPA under /promooffice-vue/ — deep links & refresh (must NOT use root /index.html)
    RewriteCond %{REQUEST_URI} ^/promooffice-vue/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* /promooffice-vue/index.html [L]

    # Never route API requests to Vue SPA
    RewriteRule ^promooffice-api(/.*)?$ - [L]
    
    # Don't rewrite if the actual file exists
    RewriteCond %{REQUEST_FILENAME} !-f
    # Don't rewrite if the actual directory exists
    RewriteCond %{REQUEST_FILENAME} !-d
    # Don't rewrite static assets - files with extensions
    RewriteCond %{REQUEST_URI} !\.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|json|map|webp|avif|html|php)$ [NC]
    # Don't rewrite API calls
    RewriteCond %{REQUEST_URI} !^/promooffice-api(/.*)?$
    # Vue SPA lives in /promooffice-vue/ (handled by that folder's .htaccess)
    RewriteCond %{REQUEST_URI} !^/promooffice-vue/
    # Don't rewrite requests to assets directory (they should be served as files)
    RewriteCond %{REQUEST_URI} !^/assets/
    # Rewrite everything else to index.html
    RewriteRule . /index.html [L]
</IfModule>

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
