Skip to content

Instantly share code, notes, and snippets.

@anlutro
Created March 19, 2014 14:14
Show Gist options
  • Save anlutro/9642488 to your computer and use it in GitHub Desktop.
Save anlutro/9642488 to your computer and use it in GitHub Desktop.
Separate app in subdirectory for Apache (Laravel 4 and AngularJS example)
<VirtualHost *:80>
# Client AngularJS application
DocumentRoot /var/www/example/client/public
# Server Laravel 4 API application
Alias /api /var/www/example/server/public
# Rewrite all requests in /api to server index.php
<Location /api>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /api/index.php [L]
</Location>
</VirtualHost>
@sdeering
Copy link

sdeering commented Aug 5, 2014

Got any examples of this in action?

@svanlacke
Copy link

Hi, I'm trying to configure my app with this configuration and I still cannot make it work.
Laravel receives the requests but is not being able to find a route. NotFoundHttpException in RouteCollection. I could se that laravel is looking for routes defined as /api/etc (that is correct) but the request path does not includes the /api prefix.

I'm using Laravel 5 and Apache2.

Any idea?

Thank you!

Sebastian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment