vendredi 30 mars 2018

Sub domain routing gives a permission error

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>

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



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2GX9ebr
via IFTTT

Aucun commentaire:

Enregistrer un commentaire