DocumentRoot /var/www/html AliasMatch "^/api(/.*)?" "/var/www/html/public$1" Options FollowSymLinks AllowOverride All Require all granted RewriteEngine On RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ /api/index.php [L] AliasMatch "^/(?!api)(.*)$" "/var/www/html/frontend/dist/$1" AllowOverride All Order allow,deny Allow from All RewriteEngine on RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^ index.html [L] ErrorLog "${APACHE_LOG_DIR}/error.log" CustomLog "${APACHE_LOG_DIR}/access.log" combined