I have two laravel based PHP applications. One is an API server, the other a client-facing website.
To avoid cross-origin issues when doing AJAX calls, I prefer to keep the API server and the website on the same domain. I.e.:
www.domain.com/* (requests served from a website project folder)
www.domain.com/api/* (requests server from an api project folder)
For the website, I have an Apache virtual host like so:
Code:
<VirtualHost *:80>
ServerAdmin email@domain.com
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /home/mainuser/www/website/public
Options Indexes FollowSymLinks MultiViews
<Directory /home/mainuser/www/website/public>
Require all granted
AllowOverride all
</Directory>
</VirtualHost>
This works fine, but now I would like to add a special case where all requests to domain.com/api/** are served by the directory /home/mainuser/www/api/public rather than /home/mainuser/www/website/public. Can this be specified in the virtual host?