PDA

View Full Version : 404.html - where on the server must it reside?


Alex Ethridge
07-18-1999, 03:08 PM
Not knowing much about this, where does the 404 file have to reside?[nbsp][nbsp]Do you need one in every folder?[nbsp][nbsp]Is only one needed?[nbsp][nbsp]If only one copy is needed for the entire site, what would be its absolute path?

Also, let's say that I had one folder for which I wanted a special 404 message and all other folders would be something different from this particular one.[nbsp][nbsp]Can that be done?[nbsp][nbsp]If so, how?

Deb
07-18-1999, 04:09 PM
The main 404 page should be in your www directory. (There was one placed there for you when your account was activated) it should be titled 404.html

The 404.html page will work for your entire site unless you make adjustments noting otherwise.[nbsp][nbsp]For information on ways to dictate a different 404 page for each directory you may want to view http://www.aota.net/ubb/Forum15/HTML/000113.html also a search for 404 on these forums will bring up all kinds of ideas for you to play with :)

Deb

Ron
07-18-1999, 04:25 PM
Here's another little tidbit about the 404 page, one that I learned the hard way. If you have any graphics on the page, or links to other pages, make sure you use absolute paths for them and not relative. Even though the 404.html sits in your root, it's actual URL will be determined by the missing page it replaces. What that effectively means is that is seemingly jumps from directory to directory, and any relative path is bound to be broken at some point.

Took me a week to figure out that a single real 404 was, in my case, generating about a score of spurious 404's. :)

Alex Ethridge
07-19-1999, 05:38 AM
Ron,

I don't understand the use of the term "absolute path" and "relative path" in your above post.

My understandings:
Absolute path - big/dom/xdomain/www/ubb/Ultimate.cgi
Web Path - http://www.xdomain/ubb/Ultimate.cgi
Relative Path - not even a clue

Am I correct about Absolute and Web paths?[nbsp][nbsp]What about the &quot;Relative&quot; path--exactly what is it and how would one use it?<!-- NO_AUTO_LINK -->
[This message has been edited by Alex Ethridge (edited 07-19-99)]

pier
07-19-1999, 05:55 AM
A quick answer:

Absolute: /big/dom/xyourdomain/www/ (Note the leading /)
Relative: ../../Images/pics/gifs/ (So, relative according to current directory)

Pier

Deb
07-19-1999, 06:02 AM
Hi Alex,

Absolute path - big/dom/xdomain/www/ubb/Ultimate.cgi You've almost got it exactly right... but you should start it with a / like this /big/dom/xdomain/www/...

Web Path - http://www.xdomain/ubb/Ultimate.cgi Almost -- http://www.domain.com/ubb/Ultimate.cgi (althought a cgi file should be in your cgi-bin http://www.domain.com/cgi-bin/ubb/Ultimate.cgi) Notice that it's a URL without the x and with the TLD

Relative Path - not even a clue Let's say you want to link to file.html from your home page... you can do this is one of two ways...

1. Using the Web Path/URL like this:
<a href=&quot;http://www.domain.com/file.html&quot;>

2. Using the relative path like this:
<a href=&quot;file.html&quot;>

The relative path is allowing the browser to assume you are referring to something within the same directory that you are already in.[nbsp][nbsp]So if you are already on domain.com and you specify a link to file.html the browser will take you to domain.com/file.html

HTH
Deb
[This message has been edited by Deb (edited 07-19-99)]

Alex Ethridge
07-19-1999, 06:57 AM
I'm still stumped by this business of a special 404 for a particular directory.

I created a .htaccess file containing the following text followed by a return:
ErrorDocument 404 /404MCity.html
into the /big/dom/xdomain/cgi-bin/MCityBB/ directory.[nbsp][nbsp]I placed a special 404MCity.html into my /big/dom/xdomain/www folder.[nbsp][nbsp]When I type the url http://www.domain/cgi-bin/MCityBB/wrong_name.cgi into the browser's location field, I still get the standard 404.html instead of the 404MCity.html.

I also tried a .htaccess file with
ErrorDocument 404 404MCity.html
and placing the 404MCity.html into the /big/dom/xdomain/cgi-bin/MCityBB folder, then typing http://www.domain/cgi-bin/wrong_name.cgi and I still get the standard 404 instead of the 404MCity.

I'm lost.<!-- NO_AUTO_LINK -->
[This message has been edited by Alex Ethridge (edited 07-19-99)]

pier
07-19-1999, 09:30 AM
I created a .htaccess file containing the following text followed by a return:
ErrorDocument 404 /404MCity.html


This is an absolute path to 404MCity in the root. You should use something like /big/dom/xyourdomain/www/Errordocs/404MCity.html (assuming 404MCity.html is in your 'Errordocs' directory.


I also tried a .htaccess file with ErrorDocument 404 404MCity.html and placing the 404MCity.html into the /big/dom/xdomain/cgi-bin/MCityBB folder,
then typing http://www.domain/cgi-bin/wrong_name.cgi and I still get the standard 404 instead of the 404MCity.


Here it also goes wrong, because the 404MCity.html is in the MCityBB-folder, and www.domain.com/cgi-bin/foobar.cgi (http://www.domain.com/cgi-bin/foobar.cgi) will result in looking for 404MCity.html in the cgi-bin, instead of the MCityBB-directory.

Hope this helps,
[nbsp]Pier
[Hmms, Justin or Deb, could you change my handle 'pier' to 'Pier' ? ]

[This message has been edited by pier (edited 07-19-99)]

Justin
07-19-1999, 04:03 PM
You should use something like /big/dom/xyourdomain/www/Errordocs/404MCity.html
Sorry, but Apache needs a URI, not a server path... anything that is a valid URI will work:

ErrorDocument 404 /404.html[nbsp][nbsp]<-- looks in document root
ErrorDocument 404 404.html[nbsp][nbsp]<-- looks in current directory
ErrorDocument 404 ./404.html[nbsp][nbsp]<-- Current directory also...

If you use /big/dom/xdomain/www/404.html, it will look for http://www.domain.com/big/dom/xdomain/www/404.html - obviously not what we are looking for :)

Best thing to do is the first one above - remember, you can't serve HTML from the cgi-bin so it will have to come from somewhere else.

BTW - can't change a username in the UBB - sorry :(

------------------
Justin Nelson
FutureQuest Support
[This message has been edited by Justin (edited 07-19-99)]

Alex Ethridge
07-19-1999, 08:54 PM
Are server paths and absolute paths the same thing?

I know what URL is.[nbsp][nbsp]What is URI?
remember, you can't serve HTML from the cgi-bin so it will have to come from somewhere else.
Does this mean that you cannot use the .htaccess in the cgi-bin or that the 404 file cannot be located in the cgi-bin or does it mean both?

(I don't understand the term, &quot;can't serve HTML from...&quot;, means)

pier
07-20-1999, 05:13 AM
Sorry, but Apache needs a URI, not a server path... anything that is a valid URI will work:


Doh.
Should check what I'm saying, next time I'm talking :)
But Alex should now know what an absolute path is.

Pier

Alex Ethridge
07-20-1999, 08:00 AM
Oh, yes.[nbsp][nbsp]Absolute path is one of the few things I do understand.