Nas Atchia
Nas Atchia

Reputation: 407

Apache Error: No matching DirectoryIndex

It's the first time I'm trying to deploy my Laravel App on my shared hosting account.

The folder structure is as follows:

|--laravel
  |--app
     |--GoPublic.php // use to point to new location 
  |--bootstrap
  |--config
  |--database
  // more folders 
|--public_html
  |--app // my subdomain document root
     |--assets
     |--index.php // GoPublic.php point to this file

When I go to my subdomain url, I get this:

enter image description here I've checked my error.log file and I get the following 403 forbidden error:

[autoindex:error] [pid 910782] [] AH01276: Cannot serve directory /home/user/public_html/app/: No matching DirectoryIndex (index.php,Index.html,Index.htm,index.html.var,index.htm,index.html,index.shtml,index.xhtml,index.wml,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.js,index.jp,index.php4,index.php3,index.phtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html) found, and server-generated directory index forbidden by Options directive

Hope anyone can help me. Thanks!

Upvotes: 2

Views: 25788

Answers (2)

Behnam Azimi
Behnam Azimi

Reputation: 2488

Maybe it's late to answering but, Make sure that you have the right permission on your public/index.php file. For example, if your user is core, you should set it as the owner of index.php too.

To change it you can use this command:

sudo chown -R core public/index.php

Upvotes: 2

Hongbin Wang
Hongbin Wang

Reputation: 1186

You can try to add .htaccess in the laraval directory and laravel/public directory.

<IfModule mod_rewrite.c>
WriteEngine On
RewriteBase /laravel/public/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Maybe you also need to point Laravel to a public directory to make it work. For example, if you've installed Laravel in /path_to_laravel/public/ directory, you need to use these settings in your Apache config:

DocumentRoot "/path_to_laravel/public/"
<Directory "/path_to_laravel/public/">

After that restart Apache and your app should work as expected.

Upvotes: 1

Related Questions