Helpful Information
 
 
Category: Web Hosting
500 Internal Server Error / missing.html file problem

Hello,

Am having a problem with the 404 missing.html file. It resides in web root and is > 1k as required.

The missing.html sometimes works (ie returns 404 and redirects to main page as I intend) but sometimes returns a 500 server error message.

If the file name: domain.com/filename.html (which does not exist) is requested the 500 message is returned. If a similar, non-existant file is requested as above but with a few random characters put into the name like domain.com/filenameXYZ.html the return is the correct 404 not found page which redirects to the main page.

In some cases the file: filename.html does exist, however it is in a lower directory: /directory/filename.com. I'm obviously missing something here, any suggestions appreciated.

Thanks.

You will see Error 500 when script's permissions are not set correctly, but the file is there. Error 404 will be returned when file doesn't exist.

You also might see Error 500 when your redirect page doesn't work correctly. Are you using FQDN (Fully Qualified Domain Name, such as http://www.yourhost.com/index.html) or just the file name (index.html). Make sure you use FQDN in your missing.html file.

I hope this helps,
-- Andrey

Actually the FQDN would be better used in the .htaccess file that you use to specify the various error pages of your site, but otherwise Andrey is correct. If you still have issues after you verify that, either post your domain here so we can all look at it, or contact support for resolution there.

Actually the FQDN would be better used in the .htaccess file that you use to specify the various error pages of your site, but otherwise Andrey is correct. If you still have issues after you verify that, either post your domain here so we can all look at it, or contact support for resolution there.

OK, thanks Chris and Andrey.

After investigating, the problem appears to be the .htaccess file. First, all 301 redirects have been removed from .htaccess. (related post to follow)

If a non-existent file is called from root and the same filename is in a lower level directory, the 500 internal server error appears, ie:

filename.html <-- 500 error if this file exists: /subdir/filename.html

If a non-existent file is called which does not have a same named cousin in a lower level directory, the missing.html file kicks in fine:

filenamexyz.html <-- customized 404 error page displays

In .htaccess we are doing a Forcetype:

<Files *.html>
ForceType application/x-httpd-php
</Files>

which seems to be tripping up missing.html. Have also tried loosing the <Files *.html> and using individual file names: <Files filenames.html> with same result.

Any suggestions appreciated.

Thanks.










privacy (GDPR)