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
# Set CORS headers based on origin
SetEnvIfNoCase Origin "^https://inventory\.valavuo\.net$" CORS_ALLOW_ORIGIN
SetEnvIfNoCase Origin "^http://localhost(:[0-9]+)?$" CORS_ALLOW_ORIGIN
SetEnvIfNoCase Origin "^http://127\.0\.0\.1(:[0-9]+)?$" CORS_ALLOW_ORIGIN
Header set Access-Control-Allow-Origin "%{CORS_ALLOW_ORIGIN}e" env=CORS_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"
Header set Access-Control-Allow-Credentials "true"
# Fallback for development
Header set Access-Control-Allow-Origin "*" env=!CORS_ALLOW_ORIGIN
# Handle OPTIONS requests for CORS
SetEnvIf Request_Method "OPTIONS" CORs
# Dynamic CORS based on origin
SetEnvIfNoCase Origin "^https://inventory\.valavuo\.net$" CORS_ALLOW_ORIGIN
SetEnvIfNoCase Origin "^http://localhost(:[0-9]+)?$" CORS_ALLOW_ORIGIN
SetEnvIfNoCase Origin "^http://127\.0\.0\.1(:[0-9]+)?$" CORS_ALLOW_ORIGIN
Header always set Access-Control-Allow-Origin "%{CORS_ALLOW_ORIGIN}e" env=CORS_ALLOW_ORIGIN
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
Header always set Access-Control-Allow-Credentials "true" env=CORs
# Fallback for development
Header always set Access-Control-Allow-Origin "*" env=!CORS_ALLOW_ORIGIN
# 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
# Set CORS headers based on origin
SetEnvIfNoCase Origin "^https://inventory\.valavuo\.net$" CORS_ALLOW_ORIGIN
SetEnvIfNoCase Origin "^http://localhost(:[0-9]+)?$" CORS_ALLOW_ORIGIN
SetEnvIfNoCase Origin "^http://127\.0\.0\.1(:[0-9]+)?$" CORS_ALLOW_ORIGIN
Header set Access-Control-Allow-Origin "%{CORS_ALLOW_ORIGIN}e" env=CORS_ALLOW_ORIGIN
Header set Access-Control-Allow-Methods "GET, HEAD, OPTIONS"
Header set Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With"
Header set Access-Control-Allow-Credentials "true"
# Fallback for development
Header set Access-Control-Allow-Origin "*" env=!CORS_ALLOW_ORIGIN
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined