Forum Moderators: phranque

Message Too Old, No Replies

custom error page is not working

custom 404 error page

         

thosecars82

2:40 pm on Oct 8, 2008 (gmt 0)

10+ Year Member



hello there
I have an error page which is working locally with a sentence like this in my .htaccess file:
ErrorDocument 404 http://www.example.com/notfound.php

For example if I browse a page of the site that does not exist and I do it on my local server installation then I get the remote page: http://www.example.com/notfound.php

Nonetheless, it turns out that when I try the same thing but browsing the page in the remote server which is not mine, then the default error page is loaded instead of mine when the user browser a page that does not exist.

Do you know why this might happen?

I just thought that it might be because the hosting company did not enable the allowoverride. Do you know if there would be any work around in case they did not enable it and do not want to enable it?

Thanks in advance

[edited by: jdMorgan at 9:04 pm (utc) on Oct. 8, 2008]
[edit reason] Please use example.com only [/edit]

wheelie34

2:50 pm on Oct 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try

ErrorDocument 404 /notfound.php

AKAIK you don't put the full URL in

thosecars82

3:07 pm on Oct 8, 2008 (gmt 0)

10+ Year Member



Well wheelie34, thanks for the reply, that was the first way I tried to make this work. However, it did not work like that and after some time I realized that if I replaced /notfound.php with the full url, then it works at least from the local server. So I still do not know how to tackle this problem.
Any suggestion?
Thanks

thosecars82

3:22 pm on Oct 8, 2008 (gmt 0)

10+ Year Member



Well, now I just got it working locally by putting the path coming after xampp/htdocs. So I got this working locally like you say, that is to say, without the full url. But what happens is that this path does not match the path I should use for the server. I think in the server I should use /www/correspondingdomain.com/notfound.php but I just placed that in the .htaccess file like this:
ErrorDocument 404 /www/correspondingdomain.com/notfound.php
and it is still now working on the remote server.
I guess I might be using a wrong path but I also tried with
ErrorDocument 404 /correspondingdomain.com/notfound.php
and with:
ErrorDocument 404 /notfound.php
and none of these ways seem to work so far.
Any suggestion?
Thanks

wheelie34

3:29 pm on Oct 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I take it your htaccess file is in the domains root? if it is I can't help any further, on of the pros will surely shed some light on it for you, sorry

g1smd

3:52 pm on Oct 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The Apache documentation for ErrorDocument specifically mentions that you must not include the HTTP method and must not include the domain name otherwise triggering the error will return a "302 Found" response.

You must use only the local filepath in this directive.

thosecars82

5:13 pm on Oct 8, 2008 (gmt 0)

10+ Year Member



Eventually I found an option in the Subdomain manager from the Control Panel of my hosting provider which has a form to fill the customized 404 error page. So it seems that somehow this hosting provider is not using the value I might pass through the .htaccess file and they use the value entered through this form. Nevertheless, they still listen to my .htaccess file for the mod_rewrite which is good because I use mod_rewrite.
Thanks

g1smd

5:29 pm on Oct 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



When you fill in the form, does that information get populated into the .htaccess file anyway?

jdMorgan

9:03 pm on Oct 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In many cases, the control-panel-based modifications get plugged into the server config file, rather than .htaccess. So this overrides the .htaccess file, which can lead to confusing results.

Jim

thosecars82

12:25 am on Oct 9, 2008 (gmt 0)

10+ Year Member



g1smd: When you fill in the form, does that information get populated into the .htaccess file anyway? No, I just checked it. It seems that the information I fill in the form of the Control Panel for the 404 error page does not get placed into the .htaccess file.
jpmorgan: I guess you are right.
Thanks