Just add a question mark at the end of your path parameter using your code, you will have something like this:
<httpErrors errorMode="Custom" existingResponse="Replace"> <remove statusCode="500" /> <error statusCode="500" responseMode="ExecuteURL" path="/error/internalservererror/?" /> </httpErrors>
source share