I'm working with Laravel 5.8 to develop my project and in this project, I have added this route:
Route::namespace('StaticPages')->prefix('tavana')->group(function () {
Route::get('/', 'TavanaStaticController@index')->name('tavanaMainFrontend');
...
});
So when I goto the url sitename.com/tavana/
, it should be retrieving data from TavanaStaticController
Controller.
But now the problem I'm facing is that, it shows 403 Forbidden:
Forbidden You don't have permission to access this resource.
This is strange, because it used to work fine!
So what's going wrong here? How can I solve this issue?
CodePudding user response:
Run the following command and see if a middleware is specified for this path or not
php artisan route:list
In the middleware column you will see the items that cause you to make a 403 error. Check out that middleware
CodePudding user response:
It was basically because of these codes written at .htaccess
file in public
directory:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
So when I go to a url like /example
on my website, it searches in public
directory and if not any folder name exists with the same name, then it will calls the Controller and its methods.