DEV Community

Cover image for PHP Laravel: How To Resolve: Access Forbidden, 403 error
Michellebuchiokonicha
Michellebuchiokonicha

Posted on • Edited on

54 1 1 1 1

PHP Laravel: How To Resolve: Access Forbidden, 403 error

If you are just getting started with PHP, you would find this useful.
While Working directly with php and laravel and accessing the admin page, you might experience the 403 forbidden permission access error.

Image description

This error can be caused by different things.

  1. The author restricted access to the admin page mostly for security reasons.

  2. You need to give the 777 permission in your htdocs. First go into your htdocs folder, then use this command: chmod 777 -R [foldername].

  3. This could be as a result of missing or misconfigured .htaccess file. If that is the issue, go to the documentation and get the correct configuration to look like this:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Enter fullscreen mode Exit fullscreen mode
  1. It can also be because you have not properly set up your .env file.

Image description

  1. It can also mean you have a folder in your public folder named 'admin'.
  2. Go to your public folder

Image description

  • change the name of the file. eg, admin_assets or what ever you choose.

Image description

Image description
Reload your browser and you should be able to view your admin page.

There are other reasons for the forbidden 403 error, however, these are the most common in php Laravel.

Follow me on Twitter Handle: https://twitter.com/mchelleOkonicha

Follow me on LinkedIn Handle: https://www.linkedin.com/in/buchi-michelle-okonicha-0a3b2b194/

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay