DEV Community

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

Posted on • Updated on

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/

Top comments (0)