[SOLVED] Can't redirect the 'default' page to the main page site.com

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

[SOLVED] Can't redirect the 'default' page to the main page site.com

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 12 Jan 2025, 15:12

I know this topic has been raised several times, and it's also described in sufficient detail in the documentation, but I still can't get it to switch from the main store (radiodar.shop/default address) to just the radiodar.shop domain.

What am I doing:
1) added

Code: Select all

'domain' => '{site}.radiodar.shop',
in each line of the file shop.php

2) added at the end of web.php file:

Code: Select all

// subdomain: vendor1.yourdomain.com
Route::group(['domain' => '{site}.radiodar.shop', 'middleware' => ['web']], function () {
    Route::get('/', '\Aimeos\Shop\Controller\CatalogController@homeAction')
        ->name('aimeos_home')->where( ['site' => '[a-z0-9\-]+'] );
});
I have do by: https://aimeos.org/docs/latest/laravel/ ... iple-shops

also trying uncomment mshop and write '/'

P.S.: I also use the catalog-home component for the home page in a multi-vendor setup

P.P.S.: I think about domeins in 3 level - maybe need write some rules at domaine registrator? Like *.radiodar.shop - and write IP?

Nothing :( at second day. I know, better get some sleep, but I whant to find my errors.
Last edited by ЕвгенияСемихова(ИПСемиховаЕ.А.) on 31 Jan 2025, 17:09, edited 1 time in total.
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

Re: Can't redirect the 'default' page to the main page site.com

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 12 Jan 2025, 15:50

I have add *.kitaidar.ru at my domein hoster's and not can open simple page (generated by HestiaCP - just simple html plug).

Don't look at kitaidar.ru and radiodar.shop - there are all for testing - I do all step by step at both VPS
Last edited by ЕвгенияСемихова(ИПСемиховаЕ.А.) on 12 Jan 2025, 15:51, edited 1 time in total.
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Can't redirect the 'default' page to the main page site.com

Post by aimeos » 14 Jan 2025, 09:14

If you don't want the site code in the URL it's best to use the domain as site code:

Code: Select all

'routes' => [
    'admin' => ['domain' => '{site}', 'prefix' => 'admin', 'middleware' => ['web']],
    'jqadm' => ['domain' => '{site}', 'prefix' => 'admin/jqadm', 'middleware' => ['web', 'auth']],
    'graphql' => ['domain' => '{site}', 'prefix' => 'admin/graphql', 'middleware' => ['web', 'auth']],
    'jsonadm' => ['domain' => '{site}', 'prefix' => 'admin/jsonadm', 'middleware' => ['web', 'auth']],
    'jsonapi' => ['domain' => '{site}', 'prefix' => 'jsonapi', 'middleware' => ['web', 'api']],
    'account' => ['domain' => '{site}', 'prefix' => 'profile', 'middleware' => ['web', 'auth']],
    'default' => ['domain' => '{site}', 'prefix' => 'shop', 'middleware' => ['web']],
    'update' => ['domain' => '{site}'],
    'home' => ['domain' => '{site}', 'middleware' => ['web']],
    'page' => ['domain' => '{site}/p', 'middleware' => ['web']],
    'supplier' => ['domain' => '{site}/s', 'middleware' => ['web']],
],
Then, the mshop_locale_site.code value must be "kitaidar.ru" or "radiodar.shop" (you have to choose which one)

See also for more things to do: https://aimeos.org/docs/latest/laravel/ ... iple-shops
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

Re: Can't redirect the 'default' page to the main page site.com

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 18 Jan 2025, 09:18

I have two tasks in this section:
1) on the main (home) page of the site, only the domain of the 2nd level (kitaidar.ru) should be displayed in the address without specifying the store's default address;
2) each new store must be transferred to its own level 3 domain (store1.kitaidar.ru)
-----------------------------------
I'm doing something wrong. According to your recommendation, I have made changes to "/myshop/config/shop.php":

Code: Select all

<?php

$multishop = $multiroute = [];
$prefix = env( 'SHOP_MULTILOCALE' ) ? '{locale}/' : '';

if( env( 'SHOP_MULTISHOP' ) ) {
	$multishop = ['routes' => [
		'admin' => ['prefix' => 'admin', 'middleware' => ['web']],
		'jqadm' => ['prefix' => 'admin/{site}/jqadm', 'middleware' => ['web', 'auth', 'verified']],
		'graphql' => ['prefix' => 'admin/{site}/graphql', 'middleware' => ['web', 'auth', 'verified']],
		'jsonadm' => ['prefix' => 'admin/{site}/jsonadm', 'middleware' => ['web', 'auth', 'verified']],
		'jsonapi' => ['prefix' => '{site}/jsonapi', 'middleware' => ['web', 'api']],
		'account' => ['prefix' => $prefix . '{site}/profile', 'middleware' => ['web', 'auth', 'verified']],
		'default' => ['prefix' => $prefix . '{site}/shop', 'middleware' => ['web']],
		'basket' => ['prefix' => $prefix . '{site}/shop', 'middleware' => ['web']],
		'checkout' => ['prefix' => $prefix . '{site}/shop', 'middleware' => ['web']],
		'confirm' => ['prefix' => $prefix . '{site}/shop', 'middleware' => ['web']],
		'supplier' => ['prefix' => $prefix . '{site}/s', 'middleware' => ['web']],
		'page' => ['prefix' => $prefix . '{site}/p', 'middleware' => ['web']],
		'home' => ['prefix' => $prefix . '{site}', 'middleware' => ['web']],
		'update' => [],
	] ];
}

if( env( 'SHOP_MULTIROUTE' ) ) {
	$multiroute = [
		'client' => [
			'html' => [
				'catalog' => [
					'multiroute' => true,
					'detail' => [
						'url' => [
							'target' => 'aimeos_resolve',
							'filter' => ['d_name', 'd_prodid', 'd_pos'],
						],
					],
					'lists' => [
						'url' => [
							'target' => 'aimeos_resolve',
							'filter' => [],
						],
					],
					'tree' => [
						'url' => [
							'target' => 'aimeos_resolve',
							'filter' => ['f_name', 'f_catid'],
						],
					],
				],
				'cms' => [
					'page' => [
						'url' => [
							'target' => 'aimeos_resolve',
						],
					],
				]
			]
		]
	];
}

return array_replace_recursive( $multiroute, $multishop + [

	'apc_enabled' => false, // enable for maximum performance if APCu is available
	'apc_prefix' => 'aimeos:', // prefix for caching config and translation in APCu
	'num_formatter' => 'Locale', // locale based number formatter (alternative: "Standard")
	'pcntl_max' => 4, // maximum number of parallel command line processes when starting jobs
	'version' => env( 'APP_VERSION', 1 ), // shop CSS/JS file version
	'roles' => ['admin', 'editor'], // user groups allowed to access the admin backend
	'panel' => 'dashboard', // panel shown in admin backend after login

	'routes' => [
		// Docs: https://aimeos.org/docs/latest/laravel/extend/#custom-routes
		// Multi-sites: https://aimeos.org/docs/latest/laravel/customize/#multiple-shops
		'admin' => ['domain' => '{site}', 'prefix' => 'admin', 'middleware' => ['web']],
		'jqadm' => ['domain'  => '{site}', 'prefix' => 'admin/{site}/jqadm', 'middleware' => ['web', 'auth']],
		'graphql' => ['domain' => '{site}', 'prefix' => 'admin/{site}/graphql', 'middleware' => ['web', 'auth']],
		'jsonadm' => ['domain' => '{site}', 'prefix' => 'admin/{site}/jsonadm', 'middleware' => ['web', 'auth']],
		'jsonapi' => ['domain' => '{site}', 'prefix' => 'jsonapi', 'middleware' => ['web', 'api']],
		'account' => ['domain' => '{site}', 'prefix' => $prefix . 'profile', 'middleware' => ['web', 'auth']],
		'default' => ['domain' => '{site}', 'prefix' => $prefix . 'shop', 'middleware' => ['web']],
		'basket' => ['domain' => '{site}', 'prefix' => $prefix . 'shop', 'middleware' => ['web']],
		'checkout' => ['domain' => '{site}', 'prefix' => $prefix . 'shop', 'middleware' => ['web']],
		'confirm' => ['domain' => '{site}', 'prefix' => $prefix . 'shop', 'middleware' => ['web']],
		'supplier' => ['domain' => '{site}', 'prefix' => $prefix . 's', 'middleware' => ['web']],
		'page' => ['domain' => '{site}', 'prefix' => $prefix . 'p', 'middleware' => ['web']],
		'home' => ['domain' => '{site}', 'prefix' => $prefix, 'middleware' => ['web']],
		'update' => ['domain' => '{site}'],
	],

	'page' => [
		// Docs: https://aimeos.org/docs/latest/laravel/extend/#adapt-pages
		'account-index' => [ 'locale/select', 'basket/mini','catalog/tree','catalog/search','account/profile','account/review','account/subscription','account/basket','account/history','account/favorite','account/watch','catalog/session' ],
		'basket-index' => [ 'locale/select', 'catalog/tree','catalog/search','basket/standard','basket/bulk','basket/related' ],
		'catalog-count' => [ 'catalog/count' ],
		'catalog-detail' => [ 'locale/select', 'basket/mini','catalog/tree','catalog/search','catalog/stage','catalog/detail','catalog/session' ],
		'catalog-home' => [ 'locale/select','basket/mini','catalog/tree','catalog/search','catalog/home', 'cms/page' ],
		'catalog-list' => [ 'locale/select','basket/mini','catalog/filter','catalog/tree','catalog/search','catalog/price','catalog/supplier','catalog/attribute','catalog/session','catalog/stage','catalog/lists' ],
		'catalog-session' => [ 'locale/select','basket/mini','catalog/tree','catalog/search','catalog/session' ],
		'catalog-stock' => [ 'catalog/stock' ],
		'catalog-suggest' => [ 'catalog/suggest' ],
		'catalog-tree' => [ 'locale/select','basket/mini','catalog/filter','catalog/tree','catalog/search','catalog/price','catalog/supplier','catalog/attribute','catalog/session','catalog/stage','catalog/lists' ],
		'checkout-confirm' => [ 'catalog/tree','catalog/search','checkout/confirm' ],
		'checkout-index' => [ 'locale/select', 'catalog/tree','catalog/search','checkout/standard' ],
		'checkout-update' => [ 'checkout/update' ],
		'supplier-detail' => [ 'locale/select','basket/mini','catalog/tree','catalog/search','supplier/detail','catalog/lists'],
		'cms' => [ 'basket/mini','catalog/tree','cms/page' ],
	],

	'resource' => [
		'db' => [
			'adapter' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.driver', 'mysql' ),
			'host' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.host', '127.0.0.1' ),
			'port' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.port', '3306' ),
			'socket' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.unix_socket', '' ),
			'database' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.database', 'forge' ),
			'username' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.username', 'forge' ),
			'password' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.password', '' ),
			'stmt' => config( 'database.default', 'mysql' ) === 'mysql' ? ["SET SESSION sort_buffer_size=2097144; SET NAMES 'utf8mb4'; SET SESSION sql_mode='ANSI'"] : [],
			'limit' => 3, // maximum number of concurrent database connections
			'defaultTableOptions' => [
				'charset' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.charset' ),
				'collate' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.collation' ),
			],
			'driverOptions' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.options' ),
		],
		'fs' => [
			'adapter' => 'Standard',
			'tempdir' => storage_path( 'tmp' ),
			'basedir' => public_path(),
			'baseurl' => rtrim(env('ASSET_URL', PHP_SAPI == 'cli' ? env('APP_URL') : ''), '/'),
		],
		'fs-media' => [
			'adapter' => 'Standard',
			'tempdir' => storage_path( 'tmp' ),
			'basedir' => public_path( 'aimeos' ),
			'baseurl' => rtrim(env('ASSET_URL', PHP_SAPI == 'cli' ? env('APP_URL') : ''), '/') . '/aimeos',
		],
		'fs-mimeicon' => [
			'adapter' => 'Standard',
			'tempdir' => storage_path( 'tmp' ),
			'basedir' => public_path( 'vendor/shop/mimeicons' ),
			'baseurl' => rtrim(env('ASSET_URL', PHP_SAPI == 'cli' ? env('APP_URL') : ''), '/') . '/vendor/shop/mimeicons',
		],
		'fs-theme' => [
			'adapter' => 'Standard',
			'tempdir' => storage_path( 'tmp' ),
			'basedir' => public_path( 'vendor/shop/themes' ),
			'baseurl' => rtrim(env('ASSET_URL', PHP_SAPI == 'cli' ? env('APP_URL') : ''), '/') . '/vendor/shop/themes',
		],
		'fs-admin' => [
			'adapter' => 'Standard',
			'tempdir' => storage_path( 'tmp' ),
			'basedir' => storage_path( 'admin' ),
		],
		'fs-export' => [
			'adapter' => 'Standard',
			'tempdir' => storage_path( 'tmp' ),
			'basedir' => storage_path( 'export' ),
		],
		'fs-import' => [
			'adapter' => 'Standard',
			'tempdir' => storage_path( 'tmp' ),
			'basedir' => storage_path( 'import' ),
		],
		'fs-secure' => [
			'adapter' => 'Standard',
			'tempdir' => storage_path( 'tmp' ),
			'basedir' => storage_path( 'secure' ),
		],
		'mq' => [
			'adapter' => 'Standard',
			'db' => 'db',
		],
		'email' => [
			'from-email' => config( 'mail.from.address' ),
			'from-name' => config( 'mail.from.name' ),
		],
	],

	'admin' => [
		'jqadm' => [
			'api' => [
				'openai' => [
					'key' => env( 'SHOP_OPENAI_APIKEY' )
				],
				'translate' => [
					'key' => env( 'SHOP_DEEPL_APIKEY' )
				],
				'removebg' => [
					'key' => env( 'SHOP_REMOVEBG_APIKEY' )
				],
			]
		]
	],

	'client' => [
		'html' => [
			'basket' => [
				'cache' => [
					// 'enable' => false, // Disable basket content caching for development
				],
			],
			'common' => [
				'cache' => [
					// 'force' => true // enforce caching for logged in users
				],
			],
			'catalog' => [
				'lists' => [
					'basket-add' => true, // shows add to basket in list views
					// 'infinite-scroll' => true, // load more products in list view
					// 'size' => 48, // number of products per page
				],
				'selection' => [
					'type' => [// how variant attributes are displayed
						'color' => 'radio',
						'length' => 'radio',
						'width' => 'radio',
					],
				],
			],
		],
	],

	'controller' => [
		'frontend' => [
			'catalog' => [
				'levels-always' => 3 // number of category levels for mega menu
			]
		]
	],

	'i18n' => [
		'en' => [
			'client' => [
				'Suppliers' => ['Brands']
			]
		]
	],

	'madmin' => [
		'cache' => [
			'manager' => [
				// 'name' => 'None', // Disable caching for development
			],
		],
		'log' => [
			'manager' => [
				// 'loglevel' => 7, // Enable debug logging into madmin_log table
			],
		],
	],

	'mshop' => [
		'locale' => [
			'site' => 'kitaidar.ru', // used instead of "default"
		]
	],


	'command' => [
	],

	'frontend' => [
	],

	'backend' => [
	],

] );
This is my "/myshop/routes/web.php":

Code: Select all

<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| 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!
|
*/

Route::get('/ready', function() {
    return 'OK';
});

$params = [];
$conf = ['prefix' => '', 'where' => []];

if( env( 'SHOP_MULTILOCALE' ) )
{
    $conf['prefix'] .= '{locale}';
    $conf['where']['locale'] = '[a-z]{2}(\_[A-Z]{2})?';
    $params = ['locale' => app()->getLocale()];
}

if( env( 'SHOP_MULTISHOP' ) )
{
    $conf['prefix'] .= '/{site}';
    $conf['where']['site'] = '[A-Za-z0-9\.\-]+';
}

if( $conf['prefix'] )
{
    Route::get('/', function() use ($params) {
        return redirect(airoute('aimeos_home', $params));
    });
}

Route::group($conf ?? [], function() {
    require __DIR__.'/auth.php';
});

if( env( 'SHOP_MULTIROUTE' ) )
{
    Route::group( $conf + ['middleware' => ['web']], function() {
        Route::match( ['GET', 'POST'], '/{path?}', array(
            'as' => 'aimeos_resolve',
            'uses' => 'Aimeos\Shop\Controller\ResolveController@indexAction'
        ) )->where( ['locale' => '[a-z]{2}(\_[A-Z]{2})?', 'site' => '[A-Za-z0-9\.\-]+'], 'path', '.*' );
    });
}
// subdomain: vendor1.yourdomain.com
//Route::group(['domain' => '{site}.kitaidar.ru', 'middleware' => ['web']], function () {
  //  Route::get('/', '\Aimeos\Shop\Controller\CatalogController@homeAction')
    //    ->name('aimeos_home')->where( ['site' => '[a-z0-9\-]+'] );
//});
When trying to open the main page kitaidar.ru returns an error and the address string becomes "https://kitaidar.ru/kitaidar.ru ":
Image

Please push me in the right direction to resolve the issue.
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Can't redirect the 'default' page to the main page site.com

Post by aimeos » 18 Jan 2025, 12:07

As you have enabled SHOP_MULTISHOP, you need to change the first route block within the if-condition. The second one will be overwritten when enabling this config setting.

If configured correctly, you have to change the site codes of the shop accordingly to:
- kitaidar.ru
- store1.kitaidar.ru
- ...

Another option is to use sub-domain routing:

Code: Select all

'routes' => [
    'admin' => ['domain' => '{site}.kitaidar.ru, 'prefix' => 'admin', 'middleware' => ['web']],
    'jqadm' => ['domain' => '{site}.kitaidar.ru', 'prefix' => 'admin/jqadm', 'middleware' => ['web', 'auth']],
    'graphql' => ['domain' => '{site}.kitaidar.ru', 'prefix' => 'admin/graphql', 'middleware' => ['web', 'auth']],
    'jsonadm' => ['domain' => '{site}.kitaidar.ru', 'prefix' => 'admin/jsonadm', 'middleware' => ['web', 'auth']],
    'jsonapi' => ['domain' => '{site}.kitaidar.ru', 'prefix' => 'jsonapi', 'middleware' => ['web', 'api']],
    'account' => ['domain' => '{site}.kitaidar.ru', 'prefix' => 'profile', 'middleware' => ['web', 'auth']],
    'default' => ['domain' => '{site}.kitaidar.ru', 'prefix' => 'shop', 'middleware' => ['web']],
    'update' => ['domain' => '{site}.kitaidar.ru'],
],
In that case, the site codes must be:
- www (you need a sub-domain for your main domain too)
- store1
- ...

Then, your stores will be available at www.kitaidar.ru and store1.kitaidar.ru
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

Re: Can't redirect the 'default' page to the main page site.com

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 18 Jan 2025, 13:40

It still doesn't work.
I need to clarify one detail: by the term "MULTISHOP" do we mean just one installation of "myshop"?
Image
Or is it required to create a separate catalog for each store using the command
"php composer create-project aimeos/aimeos store1",
"php composer create-project aimeos/aimeos store2"
...
"*** storeN"? (like at first create of myshop)

And all of them (each store in a separate directory) will be in the public_html directory?
:roll:
If so, how will it be possible to automatically create a store for a newly registered seller? I don't understand, although I've already read the documentation several times (our programmers are currently on vacation, but I also want to figure this out on my own in order to create a reliable and correct foundation for our project without further alterations).
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Can't redirect the 'default' page to the main page site.com

Post by aimeos » 19 Jan 2025, 10:55

SHOP_MULTISHOP enabled several stores in one installation.

Important:
The ./public/ directory of your Laravel installation must be the document root of the web server, not ./public_html/. You have to configure your web server correctly to make this working!
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

Re: Can't redirect the 'default' page to the main page site.com

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 20 Jan 2025, 09:43

SHOP_MULTISHOP enabled several stores in one installation.
This is certainly true: I need to understand the structure of routing stores to the appropriate level 3 domains.

Image

In the server settings themselves, I pointed to the internal directory, otherwise I would not have been able to open the main page (with the "default" store address) - everything works for me after installation, but the store address is added after the main domain (kitaidar.ru/store_N ).

Image

I did everything according to the instructions:
1) add "'domain' => '{site}.kitaidar.ru'," to "/myshop/config/shop.php":

Code: Select all

<?php

$multishop = $multiroute = [];
$prefix = env( 'SHOP_MULTILOCALE' ) ? '{locale}/' : '';

if( env( 'SHOP_MULTISHOP' ) ) {
	$multishop = ['routes' => [
		'admin' => ['domain' => '{site}.kitaidar.ru', 'prefix' => 'admin', 'middleware' => ['web']],
		'jqadm' => ['domain' => '{site}.kitaidar.ru', 'prefix' => 'admin/{site}/jqadm', 'middleware' => ['web', 'auth', 'verified']],
		'graphql' => ['domain' => '{site}.kitaidar.ru', 'prefix' => 'admin/{site}/graphql', 'middleware' => ['web', 'auth', 'verified']],
		'jsonadm' => ['domain' => '{site}.kitaidar.ru', 'prefix' => 'admin/{site}/jsonadm', 'middleware' => ['web', 'auth', 'verified']],
		'jsonapi' => ['domain' => '{site}.kitaidar.ru', 'prefix' => '{site}/jsonapi', 'middleware' => ['web', 'api']],
		'account' => ['domain' => '{site}.kitaidar.ru', 'prefix' => $prefix . '{site}/profile', 'middleware' => ['web', 'auth', 'verified']],
		'default' => ['domain' => '{site}.kitaidar.ru', 'prefix' => $prefix . '{site}/shop', 'middleware' => ['web']],
		'basket' => ['domain' => '{site}.kitaidar.ru', 'prefix' => $prefix . '{site}/shop', 'middleware' => ['web']],
		'checkout' => ['domain' => '{site}.kitaidar.ru', 'prefix' => $prefix . '{site}/shop', 'middleware' => ['web']],
		'confirm' => ['domain' => '{site}.kitaidar.ru', 'prefix' => $prefix . '{site}/shop', 'middleware' => ['web']],
		'supplier' => ['domain' => '{site}.kitaidar.ru', 'prefix' => $prefix . '{site}/s', 'middleware' => ['web']],
		'page' => ['domain' => '{site}.kitaidar.ru', 'prefix' => $prefix . '{site}/p', 'middleware' => ['web']],
		'home' => ['domain' => '{site}.kitaidar.ru', 'prefix' => $prefix . '{site}', 'middleware' => ['web']],
		'update' => ['domain' => '{site}.kitaidar.ru'],
	] ];
}
2) at the end of this file (/myshop/config/shop.php) I also add:

Code: Select all

	'mshop' => [
		'locale' => [
			'site' => 'kitaidar.ru', // used instead of "default"
		]
	],
After save this file I try to open home URL (kitaidar.ru), but this don't work:

Image

Аccording to your instructions, you also need to add routing in the file "routes/web/php":

Image

I did it, this is my file:

Code: Select all

<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| 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!
|
*/

Route::get('/ready', function() {
    return 'OK';
});

$params = [];
$conf = ['prefix' => '', 'where' => []];

if( env( 'SHOP_MULTILOCALE' ) )
{
    $conf['prefix'] .= '{locale}';
    $conf['where']['locale'] = '[a-z]{2}(\_[A-Z]{2})?';
    $params = ['locale' => app()->getLocale()];
}

if( env( 'SHOP_MULTISHOP' ) )
{
    $conf['prefix'] .= '/{site}';
    $conf['where']['site'] = '[A-Za-z0-9\.\-]+';
}

if( $conf['prefix'] )
{
    Route::get('/', function() use ($params) {
        return redirect(airoute('aimeos_home', $params));
    });
}

Route::group($conf ?? [], function() {
    require __DIR__.'/auth.php';
});

if( env( 'SHOP_MULTIROUTE' ) )
{
    Route::group( $conf + ['middleware' => ['web']], function() {
        Route::match( ['GET', 'POST'], '/{path?}', array(
            'as' => 'aimeos_resolve',
            'uses' => 'Aimeos\Shop\Controller\ResolveController@indexAction'
        ) )->where( ['locale' => '[a-z]{2}(\_[A-Z]{2})?', 'site' => '[A-Za-z0-9\.\-]+'], 'path', '.*' );
    });
}
 subdomain: vendor1.yourdomain.com
Route::group(['domain' => '{site}.kitaidar.ru', 'middleware' => ['web']], function () {
    Route::get('/', '\Aimeos\Shop\Controller\CatalogController@homeAction')
        ->name('aimeos_home')->where( ['site' => '[a-z0-9\-]+'] );
});
but it also doesn't work:

Image

I think my error at this wep.php file, please help me write right routing rules, this is importand to me to understand this alhgoritm.
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Can't redirect the 'default' page to the main page site.com

Post by aimeos » 20 Jan 2025, 10:08

Like said, when you use sub-domain routing, your main site must be www.kitaidar.ru and your web site is only available by www.kitaidar.ru and NOT kitaidar.ru. Use domain based routing if you want to be free what domains your marketplace and stores are using.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

Re: Can't redirect the 'default' page to the main page site.com

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 22 Jan 2025, 05:10

I understand why it don't work at my server - I use the HestiyaCP control panel, and on it I need to configure the domain system separately. Will learn hestia's documentations and when will write when can find solution of proublem with redirect to subdomains. https://hestiacp.com/docs/user-guide/dns.html
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

Post Reply