Skip to content
Advertisement

Host laravel application inside laravel application

I am trying to host a laravel inside a laravel application because I need it to work on the same domain.

So imagine my domain is somedomain.com. I am already pointing it to the public directory of a laravel project. Now I need to host another laravel project at the same domain (not subdomain).

How can I do this? For example somedomain.com/foo/bar to point to the public directory of another laravel project using nginx or apache?

EDIT

I tried the solution from flakerimi, and it half works for now. I am not sure what I am doing wrong.

So I went to the apache conf for the laravel application sitting on mydomain.com and made the Alias /email /dir/to/other/laravel/public change and sure now all the /email routes are going to the other laravel application. I know this because it redirecting to email/login.

But I see a 404 on all /email/ routes, but not a laravel 404, a apache 404 page. Which means that apache is going to the other laravel application but it is not able to use the routes there correctly.

I tried placing RewriteBase /email in the .htaccess file of the other laravel application but no luck. Any ideas anyone?

Advertisement

Answer

Just like you do in localhost

laravel1/public

laravel2/public

edit htaccess on laravel2 RewriteBase /laravel2

on apache

ServerName some.domain

## Path to laravel domain
DocumentRoot "/path/to/some/domain/laravel1/public"
<Directory "/path/to/some/domain/laravel1/public">
    AllowOverride All
</Directory>

## Path to laravel sub-folder
Alias /laravel2/ "/sites/laravel2/public"
<Directory "/sites/laravel2/public">
    AllowOverride All
</Directory>

also check config/session.php for both installations

L1

'cookie' => 'a_unique_name'
'path' => '/',

L2

'cookie' => 'a_unique_name_L2'
'path' => '/laravel2',
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement