ServerName localhost DocumentRoot /var/www/html/frontend/dist # Serve Vue.js frontend (SPA) AllowOverride All Require all granted # Handle Vue.js routing - redirect all non-file requests to index.html RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L] # Handle PHP API endpoints AllowOverride All Require all granted Options -Indexes # Enable CORS for API endpoints Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" Header set Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With" # Handle OPTIONS requests for CORS SetEnvIf Request_Method "OPTIONS" CORs Header always set Access-Control-Allow-Origin "*" env=CORs Header always set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" env=CORs Header always set Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With" env=CORs # API endpoint routing Alias /api /var/www/html/api # Handle uploads directory Alias /uploads /var/www/html/uploads AllowOverride All Require all granted Options -Indexes ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined