Custom 404 error pages

tonto

Perch
Has anyone gotton custom error pages (404) to work at all? I am trying to set up a custom 404 page. I have tried every combination for the URL option and have had no success. Can anyone help?

Jodohost support hasn't been much help at all!!!

I have tried:

/mydomain.com/error/404_error.htm
/mydomain/error/404_error.htm
/error/404_error.htm

Nothing works. Any suggestions?
 
Stephen,

How in the world does this help me out? I have allready tried what it says on this page and "IT DOES NOT WORK!"

I have an open ticket in which no one has given me an answer other than "look at this page." I would like jodohost to tell me the EXACT string that I should put in that damn little box for the URL method.

Can you do this? OR if you can't do this then YOU put the correct string in the box. It doesn't seem to work for me.
 
notice the \page.htm that is because it is pulling from the windows filesystem, not the http style /
 
I got them woking quiet easily!!

Just select URL and then in the box marked "Path to Custom Error page" type /404.html (or whatever your page is named) and upload your page to the root of your site
 
My custom page is in a sub-directory. Does it have to be in the root?

zonefx said:
I got them woking quiet easily!!

Just select URL and then in the box marked "Path to Custom Error page" type /404.html (or whatever your page is named) and upload your page to the root of your site
 
tonto,

you don't really have to use the URL method if you are not using ASP as the error message filetype.

using URL method it is relative to your virtual directory, which needs to be /domain.com/folder/file.htm

if that doesn't work, I can manualyl check the config and see how it is gettign entered into IIS and correct it, I just would need to know the correct file/url to point.
 
Stephen,

I just put the 404_error.htm file into my root and I tried the file method. This doesn't work either. Can you just set it up for me. It is not working for me.

Domain:
teleportjobs.com

error:
404

custom error page:
404_error.htm

I can't get it to work at all.

Very frustating JodoHost!!!

Stephen said:
tonto,

you don't really have to use the URL method if you are not using ASP as the error message filetype.

using URL method it is relative to your virtual directory, which needs to be /domain.com/folder/file.htm

if that doesn't work, I can manualyl check the config and see how it is gettign entered into IIS and correct it, I just would need to know the correct file/url to point.
 
It is set now, I refreshed and almost missed it, it just has a link down at the bottom that is different mainly. :D But, it is working now.
 
Cool. Finally. Thanks Stephen!

Stephen said:
It is set now, I refreshed and almost missed it, it just has a link down at the bottom that is different mainly. :D But, it is working now.
 
Two questions.

  • How can I change this in the future? I just logged into my CP and it does not show a custom error.
  • Do I have to go through a ticket every time I need to set up a new one or edit this one?
 
I did this manually, you can submit a ticket in the future, I am not sure why it was not working for you, others are set, it seems to be isolated.
 
tonto said:
Two questions.

  • How can I change this in the future? I just logged into my CP and it does not show a custom error.
  • Do I have to go through a ticket every time I need to set up a new one or edit this one?
It would be under "Web Services" for each domain.

FWIW, I route each error to /error.asp (select the "URL" option)
IIS attaches a querystring to the url formatted as 999;xxxxxxxx where 999 is the 3 digit error code and xxx is the URI that tossed the error. error.asp examines the query string to determine the error that called it and then does stuff based upon the error.

The stripped down version of error.asp is here...

Code:
<%
'This script...
' 1. Extracts the error code and error page from the query string passed by IIS.
' 2. Displays the error message.
' 3. Uses AspEmail to email error notification to whomever.

'You will need to change...
' 1. strDomain in "GENERAL VARIABLES"
' 2. StrReturnAddress and StrToAddress in "MAIL VARIABLES"
' 3. href for the stylesheet in the html area
' 4. Any email or html particulars you want

' -------------------------------------------------------------------------------

'GENERAL VARIABLES
Dim strDomain
	strDomain ="example.com"


' ERROR VARIABLES
dim arrErrInfo
Dim strErrorCode
Dim strErrorMessage
Dim strErrorPage


' GET ERROR CODE AND PAGE
On Error Resume Next

arrErrInfo = Split(Request.ServerVariables("QUERY_STRING"),";")
strErrorCode = Trim(arrErrInfo(0))
strErrorPage = Trim(arrErrInfo(1))


Select Case strErrorCode 
	Case "400"
		strErrorMessage = "Bad Request - Resubmitting the request may correct the problem."
	Case "401"
		strErrorMessage = "Authorization Required"
	Case "403"
		strErrorMessage = "Forbidden Resource"
	Case "404"
		strErrorMessage = "Page/Resource Not Found"
	Case "405"
		strErrorMessage = "Method Not Allowed"
	Case "500"
		strErrorMessage = "An Internal Server Error has occurred"
	Case "501"
		strErrorMessage = "Method Not Implemented"
	Case ELSE
		strErrorMessage = "An Unknown Error Has Occurred"
End Select

' -------------------------------------------------------------------------------

' MAIL VARIABLES 
Dim StrReturnAddress 
	StrReturnAddress = "postmaster@" & strDomain
Dim strMailServer 
	strMailServer = "localhost"
Dim StrSenderName 
	StrSenderName = strDomain & " Error Page"
Dim StrToAddress 
	StrToAddress = "me@" & strDomain
Dim strVariable 
Dim StrBody 
%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
	<title><%=strErrorCode%> Error at <%=strDomain%></title>
	<link rel="stylesheet" type="text/css" href="/site.css">
</head>

<body>

	<div>
		<h1><%=strDomain%></h1>
	</div>
	
	<div align="center">
		<h3>An Error Has Occurred</h3>
		<p>Error: <%=strErrorCode%> - <%=strErrorMessage%></p>
		<br/>
		<p>Requested Page: <%=strErrorPage%></p>
	</div>
	
	<div align="center" style="margin-top:30px;">This error has been logged.</div>
</body>

</html>

<%
' SEND THE EMAIL
StrBody = "Error at " & strDomain & vbCRLF
StrBody = strBody & strErrorCode & " - " & strErrorMessage & vbCRLF
StrBody = strBody & "Page = " & strErrorPage & vbCRLF

	Dim objAspEmail
	Set objAspEmail = Server.CreateObject("Persits.MailSender")
	
	objAspEmail.Host = strMailServer
	
	objAspEmail.From = StrReturnAddress 
	objAspEmail.MailFrom = StrReturnAddress
	objAspEmail.FromName = StrSenderName 
	
	objAspEmail.AddAddress StrToAddress 
	
	objAspEmail.AddReplyTo StrToAddress 
	
	objAspEmail.Subject = strErrorCode & " Error at " & strDomain
	
	objAspEmail.Body = StrBody 
	
	On Error Resume Next
	objAspEmail.Send
	Set objAspEmail = Nothing 
%>

error.asp is in the root directory. I usually use Instr to check strErrorPage for strings common to bad or moved urls and suggest alternate urls.

ONE BIG CAVEAT... for some reason, Jodohost doesn't handle favicon.ico as an image error. Firefox tosses a 404 error if it can't find favicon.ico and Jodo handles it as a page error. You'll get to your requested page when the error page starts to be written, but if you email before trying to display the error page, you'll also get an email for the favicon 404.

I work around it by putting the asp code for mailing after the html code for displaying.

EDIT: The above error handler will return an error code of "200 - OK". If you want to return the actual error code to the original requestor, add the following line after the "End Select" statement...

Response.Status = strErrorCode & " " & strErrorMessage
 
Back
Top