Reputation: 761
First of all: this is not a duplicate of (How to set up a laravel project on cPanel subdomain?) this question isn't the same as mine.
I would like to know how can i set up a whole Laravel application, with subdomains (not only one subdomain) to work on a cPanel server
So here is the test code i'm using on my routes/web.php
file.
Route::domain('test.mydomain.com')->group(function() {
Route::get('/', function() {
return 'DOMAIN TEST.MYDOMAIN.COM';
});
});
Route::domain('mydomain.com')->group(function() {
Route::get('/', function() {
return 'DOMAIN MYDOMAIN.COM';
});
});
Route::get('/', function() {
return 'ROOT DOMAIN';
});
I'm currently using cPanel to handle domains and subdomains, but i have no idea how to make it work with Laravel Subdomains, i tried the code above.
When i access my main domain mydomain.com
it shows "DOMAIN MYDOMAIN.COM" so it works ok, but when i go to test.mydomain.com
it just access my subdomain folders from this subdomain, so, how can i make it works?
Maybe i need to put some .htaccess
file to get this working properly? Can someone help?
Upvotes: 0
Views: 740
Reputation: 192
Did you try to link subdomains to the same folder as primary domain ? Eg.
domain.com => /public_html/public
test.domain.com => /public_html/public
Upvotes: 1