PDA

View Full Version : Custom 404.shtml


sparklezgrrl
09-13-2002, 08:24 AM
M'kay.. my server offers custom error pages. Great.. right? Ugh! I can't figure them out.. I cannot figure this ".shtml" out at all! I'v heard it's not much different from plain-ol-.html.. this grrl is lost. :confused: The server does offer to insert these funky looking tags tho::


<!--#echo var="HTTP_REFERER" -->
<!--#echo var="REMOTE_ADDR" -->
<!--#echo var="REQUEST_URI" -->
<!--#echo var="HTTP_HOST" -->
<!--#echo var="HTTP_USER_AGENT" -->
<!--#echo var="REDIRECT_STATUS" -->

Nice huh? Welp, my question is how do I implement these codes into my site design? The whole site has the "conformity" look. See (http://www.innocence-wasted.com/404.shtml)? I added those weirded out codes in the body and it didn't work. Any suggestions? Thanks heaps..

MCookie
09-13-2002, 09:04 AM
Looking at the code of you 404 page there's this:


<td align="center">Sorry &lt;!--#echo var=&quot;REQUEST_URI&q uot; --&gt; is not
here. You can go back &lt;!--#echo var=&q uot;HTTP_REFERER&q uot; --&gt; or go to the &lt;a href=&q uot;http://www.innocence-wasted.com&q uot;&gt;main page&lt;/a&gt; and look for the page there.</td>

You need to replace the &lt; for a <, the &q uot; for a ", and the &gt; for a >.
Since your controle panel isn't doing that, try to download the 404 page, change it by hand and upload it again.
It should look like this:

<td align="center">Sorry <!--#echo var="REQUEST_URI" --> is not
here. You can go back <!--#echo var="HTTP_REFERER" --> or go to the <a href="http://www.innocence-wasted.com">main page</a> and look for the page there.</td>

joh6nn
09-13-2002, 09:07 AM
Are you using a WYSIWYD editor? LIke maybe Frontpage or something? I ask, because when you look at the source code for your page, instead of seeing this:

<!--#echo var="REQUEST_URI" --> ,

you see this:

&amp;lt;!--#echo var=&amp;quot;REQUEST_URI&amp;quot; --&amp;gt;

sparklezgrrl
09-13-2002, 09:32 AM
Awesome--Thanks MCookie--that fixed it right up! Umm, yup I am using a WYSIWYG editor joh6nn.. Derr! I shoulda checked the code a bit more.. guess I was frustrated. Thanks fer da help tho :)

Now... heres another problem.. EEK! Kay, so I can go to 404.shtml (http://www.innocence-wasted.com/404.shtml) but say you go to a page that really doesn't exist (http://www.innocence-wasted.com/nopageliveshere.html) I am not receiving the 404 page. Any ideas? I remember somewhere that I read about an .httaccess page? Could that be the problem?

Also.. does anyone know if theres a way to make the <!--#echo var="HTTP_REFERER" --> scripty-thangy an actual link? Would be much appreciated!

MCookie
09-13-2002, 10:55 AM
Lol.. thought you were using some controlpanel to customise stuff. Yes, you need a .htaccess.
There's a tutorial here: http://www.wsabstract.com/howto/htaccess.shtml

I made a link of the HTTP_REFERER below...

<td align="center">Sorry <!--#echo var="REQUEST_URI" --> is not
here. You can go <a href="<!--#echo var="HTTP_REFERER" -->">back</a> or go to the <a href="http://www.innocence-wasted.com">main page</a> and look for the page there.</td>

sparklezgrrl
09-14-2002, 09:49 AM
Kay, Kay, MCookie.. your good! Thanks fer all the help thus far. I need some more..Alright to update what I have done.. I made the .htaccess thangy ... made things go right. Now I'm having a bit of a problem with the funky tags. The <!--#echo var="REQUEST_URI" --> isn't doing what it's suppose to instead it says *error/404.shtml*.. shouldn't it say the URL that was requested? Yanno--the url that was wrong? Also! The <a href="<!--#echo var="HTTP_REFERER" -->">back</a> code thangy ya fixed fer me.. is going to the 404 document. Freaky huh? Do you think it has anything to do with putting the 404.shtml in it's own sub folder..*errors*? That tut you gave me reccomended it so.. yeah.. Anywho, thanks again for your time & help!

MCookie
09-14-2002, 11:31 AM
So your .htaccess is in the root (where your index.shtml is) and it says:

ErrorDocument 404 /errors/404.shtml

Right? Then this should do it:

<td align="center">Sorry, the page you requested: <!--#echo var="REQUEST_URI" --> is not here.<br>
You can go <a href="javascript:history.go(-1);">Back</a> or go to the <a href="http://www.innocence-wasted.com/">main page</a> and look for the page there.</td>
(Take out the space between java and script.)

But maybe it's better to take the "back" link out. Whether you use SSI or JS for that, when someone goes straight to a page that doesn't exist (by typing in a wrong URL) there is no page to go back to (no referrer, no history) and the link wouldn't work.

<td align="center">Sorry, the page you requested: <!--#echo var="REQUEST_URI" --> is not here.<br>
Pleease go to the <a href="http://www.innocence-wasted.com/">main page</a> and look for the page there.</td>


You could also put this in your .htaccess:

ErrorDocument 404 http://www.innocence-wasted.com/

In that case you don't need a 404 page at all. When requesting a URL that doesn't exist one would go straight to the main page..