Mobile app version of vmapp.org
Login or Join
BetL925

: 500 Server Error: Cannot serve directory: No matching directory index I recently purchased a GoDaddy hosting package and uploaded all of my website files written primarily in PHP from scratch.

@BetL925

Posted in: #HttpCode500 #Php

I recently purchased a GoDaddy hosting package and uploaded all of my website files written primarily in PHP from scratch. But when I try going to my site, it only loads the head portion of the file then throws a 500 error in the inspection panel. Some Googling around told me that there's not a lot of information to be had from a 500 error and to check my cPanel logs.

The cPanel logs:

[Mon Sep 11 09:38:33.529493 2017] [autoindex:error] [pid 22333:tid 140627618502400] [client xx.xx.xx.xx:53218] AH01276: Cannot serve directory /home/mrzander/public_html/: No matching DirectoryIndex (index.html.var,index.htm,index.html,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.php,index.phtml,index.shtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html,welcome.html) found, and server-generated directory index forbidden by Options directive
[Mon Sep 11 09:26:18.658155 2017] [autoindex:error] [pid 22417:tid 140627555563264] [client xx.xx.xx.xx:52447] AH01276: Cannot serve directory /home/mrzander/public_html/: No matching DirectoryIndex (index.html.var,index.htm,index.html,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.php,index.phtml,index.shtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html,welcome.html) found, and server-generated directory index forbidden by Options directive
[Mon Sep 11 08:38:29.568926 2017] [autoindex:error] [pid 9707:tid 140627871168256] [client 158.69.2.15:37794] AH01276: Cannot serve directory /home/mrzander/public_html/: No matching DirectoryIndex (index.html.var,index.htm,index.html,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.php,index.phtml,index.shtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html,welcome.html) found, and server-generated directory index forbidden by Options directive
[Mon Sep 11 04:46:46.503303 2017] [autoindex:error] [pid 6487:tid 140627702421248] [client 69.58.178.58:50763] AH01276: Cannot serve directory /home/mrzander/public_html/: No matching DirectoryIndex (index.html.var,index.htm,index.html,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.php,index.phtml,index.shtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html,welcome.html) found, and server-generated directory index forbidden by Options directive


Other StackEchange sites mentioned editing various conf files, but I don't have access to those (httpd.conf, apache2.conf, etc.; I just have access to an .htaccess file in the public_html folder.

Is there something I need to do with the .htaccess file to resolve this error?

EDIT: Forgot to add something. The actual index.php for the website is located in a public folder within the public_html, so when someone goes to mysite.com, it directs them to mysite.com/public/index.php. Earlier today, I added an index.html to the public_html folder just to see if it would survive the error; it did not.

EDIT2: The .htaccessfile

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*) %{HTTP_HOST}%{REQUEST_URI} [L,R=301]
ErrorDocument 404 /404.html
ErrorDocument 403 /403.html
DirectoryIndex index.php index.html public/index.php


EDIT3: New Logs

[Mon Sep 11 20:16:48.016315 2017] [core:alert] [pid 23998:tid 140627618502400] [client 172.6.118.47:49812] /home/mrzander/public_html/.htaccess: Illegal option noindexes
[Mon Sep 11 20:16:48.016158 2017] [core:alert] [pid 23998:tid 140627618502400] [client 172.6.118.47:49812] /home/mrzander/public_html/.htaccess: Illegal option noindexes
[Mon Sep 11 20:15:49.343249 2017] [rewrite:error] [pid 25357:tid 140627702421248] [client 172.6.118.47:49809] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /home/mrzander/public_html/403.html
[Mon Sep 11 20:15:49.343177 2017] [rewrite:error] [pid 25357:tid 140627702421248] [client 172.6.118.47:49809] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /home/mrzander/public_html/
[Mon Sep 11 20:15:44.029303 2017] [rewrite:error] [pid 8377:tid 140627733890816] [client 172.6.118.47:49807] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /home/mrzander/public_html/403.html
[Mon Sep 11 20:15:44.029232 2017] [rewrite:error] [pid 8377:tid 140627733890816] [client 172.6.118.47:49807] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /home/mrzander/public_html/

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @BetL925

2 Comments

Sorted by latest first Latest Oldest Best

 

@Bryan171

So I finally reached out and contacted GoDaddy support. After an hour, we determined there might be an error in my code. And after a little bit of digging and testing with some basic files, he was right.

I added the following to my index.php file...

error_reporting(E_ALL);
ini_set('display_errors', 1);


AND LOW AND BEHOLD:

Fatal error: Uncaught Error: Call to undefined function mysqli_fetch_all() in /home/[redacted]/public_html/private/database.php:147 Stack trace: #0 /home/[redacted]/public_html/public/layouts/navigation.php(4): MySQLDatabase->fetchAllSubjects() #1 /home/[redacted]/public_html/index.php(49): include('/home/mrzander/...') #2 {main} thrown in /home/[redacted]/public_html/private/database.php on line 147


Which explains why the header was loading and nothing else, and why the server was throwing a 500 error. I had completely ignored the possibility of an error because mysqli_fetch_all() worked on my local machine without any trouble.

So the lesson learned here is, if you're getting a 500 error, it could potentially be a problem with your code. I'm going to fix this today and everything should be okay. Thanks to everyone who helped out.

10% popularity Vote Up Vote Down


 

@Dunderdale272

It seems that in the public_html folder there is no index.html or index.php (or other).
Are you sure after the upload there is at least a file name index.php? Can you check in ftp or file manager and see if the file is really there?

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme