We had one application which was created in angular and Laravel. So in our production env we put angular app at the root and laravel app in a subfolder within the angular app.
so /var/www/html
contained the angular app and /var/www/html/api
contained the complete laravel project.
And used to access our api url something like this.
https://example.com/api/public/api/v1/helloworld
But now we want to move our api to subdomain for many reasons. so this will be accessible like this.
https://api.example.com/api/v1/helloworld
This part is easy we did that. but for legacy support reason, we don’t to break the old URL’s.
is there a way to forward all the request coming to subfolder to the subdomain?
2
Answers
Create a symbolic link in the
public/api/v1/helloworld
folder and map it to the folder where your API app files are hosted.Also, in your .htaccess file enable
+FollowSymLinks
Just create two virtual hosts. One for your Angular application and second for your Laravel.
Angular virtual host should have
/var/www/html
as document root andexample.com
as domain.Laravel virtual host should have
/var/www/html/api/public
as document root andapi.example.com
as domain.