I use sub-domains...it example1.yoursite.com example2.yoursite.com exampleX.yoursite.com
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.
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',
);
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!
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?
Does anyone have a copy of their routes file for such a setup?
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!
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
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
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community