1 year ago

Dynamic SubDomain issue.

Posted 1 year ago by Stank0V01

Hello, guys.. so i have problem with dynamic subdomain routing! So here is my web.php


| 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::group(['domain' => env('PLAIN_URL')], function () {
    Route::get('/', '[email protected]')->name('home');
    Route::post('/gdpr', '[email protected]');

// Main site cart
    Route::group(['prefix' => 'cart'], function () {
        Route::post('/checkout', '[email protected]')->name('checkout');
        Route::get('/success', '[email protected]')->name('purchaseSuccess');
        Route::get('/failed', '[email protected]')->name('purchaseFailed');
        Route::put('/proccess', '[email protected]')->name('purchase');
        Route::get('/check', '[email protected]')->name('check');


// Shop things content
Route::group(['domain' => '{slug}.' . env('PLAIN_URL'), 'middleware' => 'ShopExist'], function () {
    Route::get('/', 'Shop\[email protected]');
    Route::get('/language/{lang}', 'Shop\[email protected]');
    Route::get('/currency/{currency}', 'Shop\[email protected]');
    Route::get('/category/{category}', 'Shop\[email protected]');

    Route::group(['prefix' => 'auth'], function () {
        Route::get('/login','Shop\[email protected]')->middleware('guest');
        Route::get('/logout','Shop\[email protected]')->middleware('auth');
        Route::post('/login','Shop\[email protected]')->middleware('guest');


So when i try it not work work only with my main domain But when i add www to first route group it again not work :/

Please sign in or create an account to participate in this conversation.