Navigate back to the homepage

How to solve 403 forbidden error in laravel?

Infinitbility
Laravel
May 20th, 2022 · 1 min read

Hello Friends 👋,

Welcome To Infinitbility! ❤️

Today, we are going to fix 403 forbidden error in laravel, here we will see causes of laravel 403 errors and their apropriate solutions.

Currently, we have 2 cases when 403 forbidden error occure, if we got any new case we will also update this post.

Let’s see how laravel forbidden error looks like, where we get this error?

Laravel, 403 forbidden error
javascript, 403 forbidden error

after setup, when you try to run your laravel application, you will get screen looks live above screen shot.

Okey, let’s start today’s topic How to solve 403 forbidden error in laravel?

Here, we are going to solve below cases

  1. .htaccess file issue
  2. Public folder name issue

.htaccess file issue

Majorly, developers face issue due to mis configuration of .htaccess file.

some are put this file in wrong folder, and some have .htaccess code not covering RewriteRule and RewriteCond.

Let’s see right way to conigure .htaccess file.

  1. Create .htaccess file in your project root folder, again here I’m saying root folder not the Public folder.

  2. put below .htaccess code in your .htaccess file.

    1<IfModule mod_rewrite.c>
    2 RewriteEngine on
    3 RewriteCond %{REQUEST_URI} !^public
    4 RewriteRule ^(.*)$ public/$1 [L]
    5</IfModule>

After done this try to access your project in browser. it shuld show your project.

Public folder name issue

Sometimes, some route showing 403 forbidden error and whole website working fine.

it’s occure due to same route name already available in public folder.

you have to write different route name or folder name in public folder.

I hope it’s help you, All the best 👍.

Follow me on Twitter

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo Photoshop Guide

Tutorials

Categories

More articles from Infinitbility

How to append an array to another array in javascript?

Example of append an array to another array in javascript with step by step guide.

May 19th, 2022 · 1 min read

How to append array to object in javascript?

Example of append array to object in javascript with step by step guide.

May 19th, 2022 · 1 min read
© 2020–2022 Infinitbility
About
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]