[OT] Overriding global .htaccess custom error page

D

David Segall

I use the free version of <http://000webhost.com/fred> to host a
couple of sites. You will see if you click on the erroneous link I
provided that they have globally specified the error page as their
home page. That default also applies to a site they host and I think
it would really confuse a visitor to my site if they landed there.

The problem is easily solved by adding an .htaccess file to my site
which directs 404 errors to my custom error page. However, I would
prefer to restore the default behaviour and let the visitor's browser
handle the error. Can you suggest a way of doing that?
 
J

Jonathan N. Little

David said:
I use the free version of <http://000webhost.com/fred> to host a
couple of sites. You will see if you click on the erroneous link I
provided that they have globally specified the error page as their
home page. That default also applies to a site they host and I think
it would really confuse a visitor to my site if they landed there.

The problem is easily solved by adding an .htaccess file to my site
which directs 404 errors to my custom error page. However, I would
prefer to restore the default behaviour and let the visitor's browser
handle the error. Can you suggest a way of doing that?

Well actually the browser does not handle the error, the server does by
sending to 404 message. So I would guess what you mean is how to restore
your server's default 404 message after you setup a custom one, easy
just delete the .htaccess file.
 
D

dorayme

"Jonathan N. Little said:
Well actually the browser does not handle the error, the server does by
sending to 404 message. So I would guess what you mean is how to restore
your server's default 404 message after you setup a custom one, easy
just delete the .htaccess file.

Does that not just get David back into the problem he thinks he faced in
the first place?

What is wrong with having a custom error page of his own? Why did he not
like it?

The style of address for this free host is like:

http://dorayme.890m.com/

and I imagine that errors on this (in the sense of after the last slash
there) a normal human client of this website hoster would not want his
visitors to trip a general ad for the webhost. Rather he would want
something like, "Hey, you got close but you screwed it up, are you
drunk..." or something more polite.
 
J

Jonathan N. Little

dorayme said:
Does that not just get David back into the problem he thinks he faced in
the first place?

(shrugs) He did say "to restore the default behaviour"
What is wrong with having a custom error page of his own? Why did he not
like it?

Don't know, ask the OP.
 
J

Jonathan N. Little

dorayme said:
Don't know, ask the OP.

I just did. Shall I ask again? <g>
[/QUOTE]

Except your replied after my quote...and you used "Why did he not like
it?" didn't seem to be a direct question to OP...
 
D

dorayme

"Jonathan N. Little said:
Except your replied after my quote...and you used "Why did he not like
it?" didn't seem to be a direct question to OP...

It was a sly, underhand, indirect, almost undignified way of getting a
message across to him. I have been reading a bit of Machiavelli and all
sorts of things are needing to to be practiced if one is in training to
be ruler of the world, an ambition of mine.

You have been very quiet lately Jonathan?
 
J

Jonathan N. Little

dorayme said:
You have been very quiet lately Jonathan?

Been trying to wrap my head around design patterns. Hard when I crawled
my way up from procedural...Singleton I grasp, but Visitor, Observer,
etc still bewilder and confound me...
 
D

David Segall

Jonathan N. Little said:
Well actually the browser does not handle the error, the server does by
sending to 404 message. So I would guess what you mean is how to restore
your server's default 404 message after you setup a custom one, easy
just delete the .htaccess file.

Apparently I was not clear. By "default behaviour" I meant I wanted
the visitor's browser to handle receiving the 404 and any other
errors. The server's default is to show the 000webhost home page which
I definitely don't want. I doubt if 000webhost will permit me to
delete their global 404 redirect.
 
J

Jonathan N. Little

David said:
Apparently I was not clear. By "default behaviour" I meant I wanted
the visitor's browser to handle receiving the 404 and any other
errors. The server's default is to show the 000webhost home page which
I definitely don't want. I doubt if 000webhost will permit me to
delete their global 404 redirect.

And again, the browser does not really "handle the error", the server
sends a response, with that "default" page, whatever it is. If you do
not like 000webhost's build your own. See for yourself:

#.htaccess code:
ErrorDocument 404 /donothing.php


<?php
/*
php errorpage 'donothing.php' that does nothing
but send a 404 error code to the browser
*/
header("HTTP/1.1 404 Not Found");
?>


But I think you will find the *blank white page* less than satisfactory.
 
D

David Segall

dorayme said:
Does that not just get David back into the problem he thinks he faced in
the first place?
Correct

What is wrong with having a custom error page of his own? Why did he not
like it?

The style of address for this free host is like:

http://dorayme.890m.com/

That address is because you won't pay for a domain name. For less than
ten dollars a year you can register nothing-much.com or dorayme.info
and host it there for free.
and I imagine that errors on this (in the sense of after the last slash
there) a normal human client of this website hoster would not want his
visitors to trip a general ad for the webhost.

Exactly. If someone goes to <http://dorayme.890m.com/not_there> they
will see the 000webhost home page because you have not provided an
..htaccess file and a custom error page.
Rather he would want
something like, "Hey, you got close but you screwed it up, are you
drunk..." or something more polite.

That is the first reason why I would prefer not to have a custom error
page. If someone is going to be rude to a visitor I would prefer it
was her browser rather than my web site. I think the topic deserves a
separate thread so I have started one. The second reason is that I
don't know what they do with other errors. I don't even know what
other errors are possible.
 
R

Rob W.

David Segall schreef:
That is the first reason why I would prefer not to have a custom error
page. If someone is going to be rude to a visitor I would prefer it
was her browser rather than my web site.


You can design any kind of error page you want.
Are you telling us that you are rude by nature and can't help yourself?

I've been following this discussion, and I can't figure out your problem
(or: your reasons for not wanting your own error pages).


I think the topic deserves a
separate thread so I have started one. The second reason is that I
don't know what they do with other errors. I don't even know what
other errors are possible.


Just google for "error 404" and you'll find a wealth of pages
giving information about error pages,
other response status codes (like 404)
and examples of 404-pages from other websites.

I've visited a site once that showed a collection of the most creative
404-pages; don't know the URl anymore.
 
D

David Segall

Admin said:
That's not an option, I'm afraid. HTTP servers always send a full-page
response for 404 errors. Browsers never do "handle" the error, they just
display whatever response the server sent.

What you're looking for is the default Apache 404 page.

You have correctly exposed my ignorance on the topic of error pages
but you apparently lead a sheltered life away from Microsoft servers
and browsers :)
Will they let you provide your own custom error page?

If so, point your browser to a nonsense URL on an Apache server that
is using the default error page, and save the response. Then upload
the saved page to your server, and use it as your "custom" 404 page.

Clever! Unfortunately, it doesn't quite work because Apache includes
the path to the web page in the error message. However, trying it
explained one of the causes of my confusion. Internet Explorer
_sometimes_ substitutes its own error page for the server's error page
which is why I thought the message depended on the browser. A Google
search indicates that Internet Explorer's behaviour depends on the
number of characters in the error page but my experiments and Ed
Mullen's post in a separate thread contradict this explanation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top