close

[Solved] Laravel 5.4 on Heroku. Forbidden You don’t have permission to access / on this server

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Laravel 5.4 on Heroku. Forbidden You don’t have permission to access / on this server in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Laravel 5.4 on Heroku. Forbidden You don’t have permission to access / on this server Error Occurs?

Today I get the following error Laravel 5.4 on Heroku. Forbidden You don’t have permission to access / on this server in php.

How To Solve Laravel 5.4 on Heroku. Forbidden You don’t have permission to access / on this server Error ?

  1. How To Solve Laravel 5.4 on Heroku. Forbidden You don't have permission to access / on this server Error ?

    To Solve Laravel 5.4 on Heroku. Forbidden You don't have permission to access / on this server Error The issue started after I setup an HTTPS redirect, by adding an apache configuration file, and loading it using the -C option in the Heroku Procfile:

  2. Laravel 5.4 on Heroku. Forbidden You don't have permission to access / on this server

    To Solve Laravel 5.4 on Heroku. Forbidden You don't have permission to access / on this server Error The issue started after I setup an HTTPS redirect, by adding an apache configuration file, and loading it using the -C option in the Heroku Procfile:

Solution 1

SOLUTION STEPS:

  1. Clone your project to your PC: heroku git:clone -a your-app-name
  2. Create a file name: Procfile
  3. Then save following lin of code in this Procfile web: vendor/bin/heroku-php-apache2 public/
  4. Deploy your project back to heroku using commed: $ git add . $ git commit -am "make it better" $ git push heroku master
  5. I hope now no problem run your Laravel App!

Solution 2

I was having the same issue today, and have found an easy solution to it. I’m running a Laravel 6 app on Heroku.

The issue started after I setup an HTTPS redirect, by adding an apache configuration file, and loading it using the -C option in the Heroku Procfile:

web: vendor/bin/heroku-php-apache2 -C apache.conf public/

The error I was receiving:

2020-01-13T03:55:29.272349+00:00 app[web.1]: [Mon Jan 13 03:55:29.271704 2020] [autoindex:error] [pid 127:tid 140227477751552] [client 10.213.231.122:26179] AH01276: Cannot serve directory /app/public/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive

So the same issue as you were having. What I found was that when you start apache with a custom configuration on Heroku, it starts looking for an index.html file, instead of an index.php file.

To fix this, I added the following line to my apache configuration file:

DirectoryIndex index.php

This directs apache to look for index.php, and fixes the issue.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment