This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Webmaster forum > March 2007 > .htaccess problem





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author .htaccess problem
Paul Blarmy

2007-03-29, 7:19 pm

Hi

I have a .htaccess file in my root directory with just five lines:

ErrorDocument 400 http://www.mydomain.co.uk/error.html
ErrorDocument 403 http://www.mydomain.co.uk/error.html
ErrorDocument 404 http://www.mydomain.co.uk/error.html
ErrorDocument 500 http://www.mydomain.co.uk/error.html
AddType x-mapp-php4 .html .htm

The last line allows my PHP files to integrate with my HTML pages and
works great. The other lines were included as per the FAQs on my hosts
pages and are meant to allow me to show custom error messages rather
than the hosts default 404 page etc. Trouble is, it doesn't work and I
still get the hosts default coming up.

Anyone got any ideas? My host is 1and1 if that is any help.

(www.mydomain.co.uk is just an example of course!)

TIA

--
EMail address is disposable and never checked.
Registered Linux user #439066.
Karl Groves

2007-03-29, 7:19 pm

Paul Blarmy <foxesfan@trashmail.net> wrote in
news:MPG.20762d64fe934fa9898f1@62.253.170.163:

> Hi
>
> I have a .htaccess file in my root directory with just five lines:
>
> ErrorDocument 400 http://www.mydomain.co.uk/error.html
> ErrorDocument 403 http://www.mydomain.co.uk/error.html
> ErrorDocument 404 http://www.mydomain.co.uk/error.html
> ErrorDocument 500 http://www.mydomain.co.uk/error.html
> AddType x-mapp-php4 .html .htm
>
> The last line allows my PHP files to integrate with my HTML pages and
> works great. The other lines were included as per the FAQs on my hosts
> pages and are meant to allow me to show custom error messages rather
> than the hosts default 404 page etc. Trouble is, it doesn't work and I
> still get the hosts default coming up.
>
> Anyone got any ideas? My host is 1and1 if that is any help.
>
> (www.mydomain.co.uk is just an example of course!)
>
> TIA
>


Delete the http://www.mydomain.co.uk bit and just use the root-relative
path to the file, like so: /error.html

--
Karl Groves
http://www.thehotrodclassifieds.com
http://www.grayscalecms.com
http://www.karlcore.com

Christo

2007-03-29, 11:17 pm

You do have a file called error.html in your main directory?



"Karl Groves" <karl@NOSPAMkarlcore.com> wrote in message
news:Xns9902A57F78BC8karlkarlcorecom@199.45.49.11...
> Paul Blarmy <foxesfan@trashmail.net> wrote in
> news:MPG.20762d64fe934fa9898f1@62.253.170.163:
>
>
> Delete the http://www.mydomain.co.uk bit and just use the root-relative
> path to the file, like so: /error.html
>
> --
> Karl Groves
> http://www.thehotrodclassifieds.com
> http://www.grayscalecms.com
> http://www.karlcore.com
>



Paul Blarmy

2007-03-30, 4:20 am

On Fri, 30 Mar 2007 00:32:01 GMT, Christo wrote...

> You do have a file called error.html in your main directory?


Heh!
I have overlooked the obvious in the past, but not on this occasion :-)

--
EMail address is disposable and never checked.
Registered Linux user #439066.
Paul Blarmy

2007-03-30, 4:20 am

On Thu, 29 Mar 2007 20:16:47 GMT, Karl Groves wrote...

> Delete the http://www.mydomain.co.uk bit and just use the root-relative
> path to the file, like so: /error.html


I've done this but am now still puzzled as it is working in one respect
but not another. If the URL hasn't got a .html or .htm extension (e.g
http://www.domain.com/test) then my error page shows up. If however the
extension *is* stated (e.g. http://www.domain.com/test.html) then I
still get the hosts default page settings.

Any other ideas? Thanks again.

--
EMail address is disposable and never checked.
Registered Linux user #439066.
Toby A Inkster

2007-03-30, 7:17 pm

Paul Blarmy wrote:

> (www.mydomain.co.uk is just an example of course!)


Please use example.com, example.net or example.org for examples -- they
are registered specifically for that purpose. The real owner of
mydomain.co.uk might not take kindly to you posting his domain around
everywhere.

As Karl said, you probably want to use just:

ErrorDocument 400 /error.html
ErrorDocument 403 /error.html
ErrorDocument 404 /error.html
ErrorDocument 500 /error.html

The code you posted should work, but will cause a redirect rather than a
URL rewrite -- a rewrite is neater and causes less work for both the client
and server.

If your code is as above, then you really shouldn't be having any
problems. Does "error.html" work when you visit it normally?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Paul Blarmy

2007-03-30, 7:17 pm

On Fri, 30 Mar 2007 17:09:31 +0100, Toby A Inkster wrote...

> Please use example.com, example.net or example.org for examples -- they
> are registered specifically for that purpose. The real owner of
> mydomain.co.uk might not take kindly to you posting his domain around
> everywhere.


Looking at the site, the owner is probably grateful for a link! Sorry,
jesting aside you have a valid point.

> As Karl said, you probably want to use just:
>
> ErrorDocument 400 /error.html
> ErrorDocument 403 /error.html
> ErrorDocument 404 /error.html
> ErrorDocument 500 /error.html
>
> The code you posted should work, but will cause a redirect rather than a
> URL rewrite -- a rewrite is neater and causes less work for both the client
> and server.
>
> If your code is as above, then you really shouldn't be having any
> problems. Does "error.html" work when you visit it normally?


Yes, error.html displays fine. If you see one of my replies above, it
works fine when an unspecified link is given e.g. www.example.com/test
but NOT if the actual html or htm file is mentioned, e.g.
www.example.com/test.html

Have emailed support at my hosts but they are notoriously slow and often
give vague answers.

--
EMail address is disposable and never checked.
Registered Linux user #439066.
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews