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

anandmainali5's avatar

403 Forbidden in laravel project in cpanel

How to solve 403 forbidden error in laravel project ??

0 likes
10 replies
MThomas's avatar

ehm...

Why not start by giving us some more information, without that you cannot help yourself and we can't help you...

anandmainali5's avatar

@MThomas When i upload my laravel app to the server it is showing 403 Forbidden error. But it is perfectly working in the localhost. I am getting this error in error log : File not found [/home/anandmainali/public_html/403.shtml].

Saikishore's avatar

@anandmainali5 , Can you check the Storage/logs folder for Clear error. It will help you to figure out exact problem.

Also check your domain exactly mapping to Public folder.

Saikishore's avatar

Hi @anandmainali5

As per my understanding, you are trying to access root folder instead of public folder in server.

1 like
anandmainali5's avatar

@Saikishore I am using the same .htaccess code and it works perfectly. But in this project i am getting this 403 error.

suzy_bae's avatar

My .htaccess code is as below. it is working fine on local but not on server. showing 403 forbidden error. i tried to change permission for .htaccess still it is not working. please suggest some solution

Options -MultiViews -Indexes
RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

#RewriteCond %{HTTPS} on
#RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
dipendra.chaudhary's avatar

I have setup a laravel project and created a subdomain to point that folder. Everything works well except that when i visit that subdomain in another tab, it throws 403 forbidden. I cant even access the htaccess file.

Please or to participate in this conversation.