Closed woodwardmatt closed 2 years ago
Just to confirm that the full content under routes/web.php is:
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Auth::routes(['verify' => true]);
Route::get('/', '\Aimeos\Shop\Controller\CatalogController@homeAction')->name('aimeos_home');
Route::get('{path?}', '\Aimeos\Shop\Controller\PageController@indexAction')->name('aimeos_page')->where( 'path', '.*' );
// custom domain: vendor1.com
Route::group(['domain' => '{site}', 'middleware' => ['web']], function () {
Route::get('/', '\Aimeos\Shop\Controller\CatalogController@homeAction')->name('aimeos_home')->where( ['site' => '[a-z0-9\.\-]+'] );
});
For anyone else that comes across this, you need the following in your routes/web.php file:
// custom domain: vendor1.com
Route::group(['domain' => '{site}', 'middleware' => ['web']], function () {
Route::get('/', '\Aimeos\Shop\Controller\CatalogController@homeAction')->name('aimeos_home')->where( ['site' => '[a-z0-9\.\-]+'] );
});
Route::get('{path?}', '\Aimeos\Shop\Controller\PageController@indexAction')->name('aimeos_page')->where( 'path', '.*' );
The line from the above comment is removed:
Route::get('/', '\Aimeos\Shop\Controller\CatalogController@homeAction')->name('aimeos_home');
Environment
Describe the bug I've setup two domains to point at the same instance. The outcome I'm trying to achieve here is to have two sites branded with their own theme, have their own shop / products and have their own homepages.
I've updated the routes in config/shop.php to:
I've appended the following to routes/web.php:
I've also updated the .env file to have the following configuration:
SHOP_MULTISHOP=true
It's also worth noting that the APP_URL in the .env file points at the url for the first domain.
I have left the first domain (e.g. local.shop.com) with a site code of default, and the second domains I have given a sitecode to match the domain (e.g. local.domain.com) .
I have the first domain using a custom theme and the second domain using the default (just so they look differently to test).
Expected behavior I'm expecting that if I go to the first domain I would see the theme and homepage content associated with the first / default domain. I'm also expecting that if I go to the second domain I would see the theme and homepage content associated with the second domain. Like wise for accessing the shops / products for each domain.
Observed behavior When I go to the first domain, I see the theme and homepage content of the first site (which is correct). When I try to go to the shop (or a product directly) of the first site I get an error (No item found for conditions: Array ( [locale.site.code] => local.shop.com ))
When I go to the second domain, I see the theme and homepage of the first site (which is incorrect). When I try to go to the shop (or a product directly) of the second site, I see the shop with the theme and content of the second site (which is correct)
Questions What configuration changes do I need to make to resolve the routing for the above setup with the two shops / domains.