If you’ve "reinstalled Apache" then the defaultDirectoryIndex is just index.html. You need this set to index.php in order to serve your Laravel front-controller.
When Apache does not find the DirectoryIndex document (eg. index.html) when requesting a directory and directory indexes/listings (mod_autoindex) are enabled (the default) then Apache generates a directory listing as you are seeing here.
You need to set index.php as the DirectoryIndex, for example:
<Directory /var/www/html/wafacashapp>
AllowOverride All
Require all granted
DirectoryIndex index.php
</Directory>
Alternatively, you can set the DirectoryIndex in your .htaccess file – if you have one. (If you aren’t using .htaccess files then you should disable .htaccess overrides by setting AllowOverride None.)
You should also consider disabling directory indexes/listings, so as to not expose the contents of your directories should a DirectoryIndex document not be found. For example, in the same <Directory> container (or .htaccess file):
Options -Indexes
The user will then be served a 403 Forbidden instead of a directory listing.
2
Answers
you can add .htaccess file to root’s of project and add these lines
If you’ve "reinstalled Apache" then the default
DirectoryIndex
is justindex.html
. You need this set toindex.php
in order to serve your Laravel front-controller.When Apache does not find the
DirectoryIndex
document (eg.index.html
) when requesting a directory and directory indexes/listings (mod_autoindex) are enabled (the default) then Apache generates a directory listing as you are seeing here.You need to set
index.php
as theDirectoryIndex
, for example:Alternatively, you can set the
DirectoryIndex
in your.htaccess
file – if you have one. (If you aren’t using.htaccess
files then you should disable.htaccess
overrides by settingAllowOverride None
.)You should also consider disabling directory indexes/listings, so as to not expose the contents of your directories should a
DirectoryIndex
document not be found. For example, in the same<Directory>
container (or.htaccess
file):The user will then be served a 403 Forbidden instead of a directory listing.