Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

chuckc's avatar

403 forbidden on one specific route

Hello,

Suddenly, I got a "403 Forbidden" on one specific route:

Route::get('/offers', 'OffersController@index');

When I try to change /offers to /foobar, it works perfectly.

I didn't change anything in my routes or in my index() function since it was working. I have other routes for '/offers/*, and they work perfectly:

Route::get('/offers/create', 'OffersController@create');
Route::get('/offers/{id}', 'OffersController@show');
Route::post('/offers', 'OffersController@store');
Route::post('offers/{id}/photos', 'OffersController@addPhoto');

I'm using homestead of course.

Anyone has any ideas from where it could come from ? Or at least, how can I debug this ? Is there logs for nginx or something where I could find more information about that 403 error ?

Thanks

0 likes
11 replies
bobbybouwmann's avatar

Not sure what's going on here.. Should work fine!

You can however leave the slash from the route

Route::get('offers', 'OffersController@index');
chuckc's avatar

Thanks for the tip bobby. I still did not found what the problem is. I also tried to restart the server but nothing changes. Is there a way (logs?) to find more informations about a 403 error ?

chuckc's avatar
chuckc
OP
Best Answer
Level 8

I found the problem: I had a folder named "offers" in the public folder.

30 likes
jcdev518's avatar

This is a good reason to be careful about what you put in your public folder. I had the same problem and could not figure out what was going on until I read this.

I can't read from the /storage/** folders for a file upload, even after putting up a symlink per php artisan storage:link and it was driving me nuts so I took the shortcut and sent the file to public_path('/folder/file').

2 likes
michael@cronin.software's avatar

@CHUCKC - Thanks so much for posting your issue. I just had the exact same thing happen. I created a projects/images folder in my public folder. Then the projects route had a 403 Forbidden. After reading this post I removed the folder and I am up and running again.

I too restarted my server etc. Anyways, thanks mate!

1 like
polodev's avatar

@chuckc Thank you so much for your posting. It helps me lot. You saves my day

1 like
manikbajaj's avatar

Thank you so much for posting your issue even had the same problem and I was going nuts troubleshooting!!

1 like
Sajjad Ali's avatar

Just ran into same issue and i was like what happened, how, why... Thanks for posting the answer.

1 like
priyanganamal's avatar

Thank you very much. I was looking for this error more almost one week now. Life savier.

1 like

Please or to participate in this conversation.