Custom 404 error pages

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?

http://www.psoft.net/HSdocumentation/user/manipulating_pages.html#error_pages

That should help you out.

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 /

[QUOTE=Stephen]
notice the \page.htm that is because it is pulling from the windows filesystem, not the http style /
[/QUOTE]

Stephen,

That’s not what it says for the URL option. It says to use the / Again please tell me the exact string to use if my custom error page is located at:

http://www.mydomain.com/error/404_error.htm

I want to use the URL option.

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?

[QUOTE=zonefx]
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
[/QUOTE]

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.

Just putting /404.html Works for me so I assume /error/error.html would work too

http://www.divebermuda.com/any_text_at_all_here.html

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:

error:
404

custom error page:
404_error.htm

I can’t get it to work at all.

Very frustating JodoHost!!!

[QUOTE=Stephen]
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.
[/QUOTE]

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

Cool. Finally. Thanks Stephen!

[QUOTE=Stephen]
It is set now, I refreshed and almost missed it, it just has a link down at the bottom that is different mainly. :smiley: But, it is working now.
[/QUOTE]

Two questions.

[ul]
[li]How can I change this in the future? I just logged into my CP and it does not show a custom error. [/li][/ul]
[ul]
[li]Do I have to go through a ticket every time I need to set up a new one or edit this one? [/li][/ul]

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.

[QUOTE=tonto]
Two questions.

[ul]
[li]How can I change this in the future? I just logged into my CP and it does not show a custom error.
[/li][/ul]
[ul]
[li]Do I have to go through a ticket every time I need to set up a new one or edit this one?
[/li][/ul]
[/QUOTE]

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
%>

<%=strErrorCode%> Error at <%=strDomain%>
<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>

<%
’ 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 

%>[/CODE]

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