php - Host laravel application inside laravel application
Get the solution ↓↓↓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 examplesomedomain.com/foo/bar
to point to the public directory of another laravel project using nginx or apache?
EDIT
I tried the solution fromflakerimi
, 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 theAlias /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 toemail/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 placingRewriteBase /email
in the .htaccess file of the other laravel application but no luck. Any ideas anyone?
Answer
Solution:
Just like you do in localhost
laravel1/public
laravel2/public
edit htaccess on laravel2RewriteBase /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 checkconfig/session.php
for both installations
L1
'cookie' => 'a_unique_name'
'path' => '/',
L2
'cookie' => 'a_unique_name_L2'
'path' => '/laravel2',
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: port 80 in use by "unable to open process" with pid 4!
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.