Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 2 years ago.
0

Yes. I have sub-domains. www1.thissite.com, www2.thissite.com, www3.thissite.com.

But I also have www1.thatsite.com, www2.thatsite.com, www3.thatsite.com.

And also, www1.another.com, www2.another.com, www3.another.com.

I want all of these sites to use the same shopping cart model, the same FedEx shipping API, the same SMTP protocols, etc. I don't want to make multiple copies of all these things and then have to touch each copy when I need to change a password or add a feature.

These are all separate websites with different functionality, skinning, products offered, etc., but since I am hosting and administering them all on one web server, I want them to share as much core functionality as I can.

0

I'm doing it like this:

Every website has his own application, bootstrap and public folder. The core system only has the rest of the folders. If you update the paths to the correct folders at each website's bootstrap it wouldn't be a problem.

I'm using something like this:

return array(	
	'app' 	=> __DIR__.'/../app',
	'public'	=> __DIR__.'/../public_html',
	'base'	=> '/home/user/domains/domain.com/',
	'storage' 	=> __DIR__.'/../app/storage',
	'api'		=> '/home/user/domains/domain.com/api',
);
Last updated 9 years ago.
0

Ok. I think I've got it, but will test it out once I have the first site working the way I want, and start on the second one.

Each application will have its own public and bootstrap folder.

All applications will share a single instance of the root files (composer.json, artisan, etc.) along with the app and vendor folders.

So my folder tree may look something like this:

Laravel_Install  
   www1.example.com  
      bootstrap  
      public  
   www2.example.com  
      bootstrap  
      public  
   www.another.com  
      bootstrap  
      public  
   admin.another.com  
      bootstrap  
      public  
   app  
   vendor  
   composer.json  
   artisan  

I'll give that a try, but if anyone has anything else to add I would appreciate it.

Thanks!

Last updated 9 years ago.
0

Any further info regarding how this strategy is working? I've spent several hours researching methods for running multiple sites on a single Laravel installation, and this solution is the most promising.

@blyleven: Have you deployed production websites using this strategy? Are there any known limitations?

0

Does anyone have a copy of their routes file for such a setup?

0

@treadman

You can further extend seperation with different view folders:

Create a 'views' folder in each domain when you detect your domain you can:

Config::set('view.paths', base_path($domain_name.'/views'));

and now you can just View::make('view-name');

Same goes for routes: From routes.php include("$domain_name/routes.php); and create a route.php in each domain. Be carefull however that you can not URL::route_to from one domain to an other!

Last updated 9 years ago.
0

Hey,

Why not to use a virtualhost for that?

For example - point all of the sites to Laravel directory and make the Laravel base - current URL. Do not pin route to a specific domain and that should be done.

I've used this with my page and it worked flawless

0

Hi,

I'm new in laravel and think to replace our old multisite CMS.
If you solved the problem of Multiple websites with one Laravel installation, can tell me the key steps please ?

Thank you

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

treadman treadman Joined 30 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.