Click here to Skip to main content
15,113,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to configure sub-domain routing for my laravel web application.
What I am doing in web.php looks like:


Route::group(['domain' => 'example.in'], function () {

Route::get('/', 'CustomController@showWelcomePage');
});

Route::domain('{account}.example.in')->group(function () {
Route::get('event-organizer/{account}','CustomController@getOrganizerPage')->name("sub_domain");
});


and in my custom controller:

public function showWelcomePage() {

    $eventData = Event::all();

    return view('welcome')->with('eventData', $eventData);
}

 public function getOrganizerPage($account) {

    $organizer_name = User::where('org',$account)->first();

    $eventData = Event::where('user_id', $organizer_name->id)->get();
    return view('single_organizer_page')->with('eventData', $eventData);
}


and my .htaccess file looks like:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>

RewriteEngine On


# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.in/$1 [R=301,L]


# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

</IfModule>


Quote:


I am able to create sub domain dynamically successfully but whenever I hit the url

http://testorg.example.in/

I get a error saying this:

Forbidden You don't have permission to access / on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

I don't know where am I going wrong!!


What I have tried:

Link 1

<a href="Link 2
">
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900