0

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?

1 Answer 1

1

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',
Sign up to request clarification or add additional context in comments.

4 Comments

The conf file part seems to be working, the /laravel2 routes are going to the other directory, but apache is complaining not found. I have a feeling I need to make some changes to RewriteBase /laravel2, maybe RewriteRule?
In nginx, it is working like rewrite /mail/(.*)$ /mail/index.php?/$1 last;
Yeah, my code is abstract, now you have to replace them with your config.
Oh no it worked, I forgot to add allow override in ssl section. Thanks man!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.