I have a site being served by an Apache server, with the following structure:
On the main directory, I have a front-end app.
On a subdirectory named API, I have an API running on Laravel.
When I make calls to the API the URL look like this: domain/api/api/specific-route I would like it to look like this: domain/api/specific-route
This is the relevant part of the virtual host config file:
ServerName my-domain.com
ServerAlias www.my-domain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/my-domain
<Directory /var/www/my-domain>
RewriteEngine On
RewriteBase /
# Serve files when they are found
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# When file is not found, serve index.html instead
RewriteRule ^ /index.html
</Directory>
<Directory /var/www/my-domain/api>
RewriteEngine on
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
ErrorLog /var/www/my-domain/error.log
CustomLog /var/www/my-domain/access.log combined
# Aliases
Alias /api /var/www/my-domain/api/public