Invalid URL server error 500

Asked

Viewed 477 times

1

Whenever having access a URL that does not exist on my site, this error appears

The server encountered an Internal error or misconfiguration and was Unable to complete your request.

Have any way to customize this error message or show a default page?

The site is in Wordpress and does not have . htaccess, but I can change Apache settings directly.

I inserted the line

 ErrorDocument 500 /error/erro500.html

and one more mistake appeared:

Additionally, a 500 Internal Server Error was encountered while trying to use an Errordocument to Handle the request.

  • 1

    "Additionally, a 500 Internal Server Error was encountered while trying to use an Errordocument to Handle the request." - That is to say, there was yet another error within your error handling process. :(

2 answers

1

If you’re using Apache as a WEB server, add this line to the file .htaccess:

ErrorDocument 500 http://yourwebsite.com/error-500

That file .htaccess must be at the root of the public directory of the site.

The odd point in your question is that error 500 should indicate an internal error on the server.

The correct code for missing page is code 400.

Maybe you have something misconfigured on the server or it may even be some command sent by scripts like PHP.

1

You can customize the errors yes.

ErrorDocument 500 "Sorry, our script crashed. Oh dear"
ErrorDocument 500 /cgi-bin/crash-recover
ErrorDocument 500 http://error.example.com/server_error.html
ErrorDocument 404 /errors/not_found.html 
ErrorDocument 401 /subscription/how_to_subscribe.html

Reference: https://httpd.apache.org/docs/2.4/custom-error.html

Or if you are using Nginx server:

error_page 404 /404.html;

In the example of these commands every time the error is triggered, it will call the pre-defined message or page. Be careful not to cause a loop.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.