Help - Search - Members - Calendar
Full Version: Custom Error Doc, How?
The Planet Forums > Control Panels > Plesk > Plesk HOWTOs
Zimike
Hello

Have been trying to setup a custom error page for 404 pages. Basicly I want when anything random at a domain:

domain.com/asdf to point to a custom 404 page.

I have tried editing the custom error pages at:

/home/httpd/vhosts/domain.com/error_docs/

Still it always shows that standard 404 page. I tried editing the .htaccess file and adding this:

[root@server httpdocs]# cat .htaccess
ErrorDocument 400 /error_docs/bad_request.html
ErrorDocument 403 /error_docs/forbidden.html
ErrorDocument 404 /error_docs/not_found.html
ErrorDocument 500 /error_docs/internal_server_error.html

No luck here. I tried making custom pages:

ErrorDocument 404 /test.html

Still no luck. I am running Plesk 7.5.3 and any tips on getting cusom error pages to work would be great icon_smile.gif
Yivit
You should be able to edit or replace the files in /home/httpd/vhosts/domain.com/error_docs/. Just remember if you use different named files to change the reference in /home/httpd/vhosts/domain.com/conf/httpd.include. Also, you have to restart Apache for it to read the new configuration.
Zimike
Thanks for your help, I have pretty much gave up at this point. Tired everything possible.. searched every possible post here and plesks forums without any luck.


This is what I have in my httpd.include:

Alias "/error_docs" "/home/httpd/vhosts/domain.com/error_docs"
ErrorDocument 400 /error_docs/bad_request.html
ErrorDocument 401 /error_docs/unauthorized.html
ErrorDocument 403 /error_docs/forbidden.html
ErrorDocument 404 /error_docs/not_found.html
ErrorDocument 500 /error_docs/internal_server_error.html


This is what I also have in my .htaccess


ErrorDocument 400 /error_docs/bad_request.html
ErrorDocument 401 /error_docs/unauthorized.html
ErrorDocument 403 /error_docs/forbidden.html
ErrorDocument 404 /error_docs/not_found.html
ErrorDocument 500 /error_docs/internal_server_error.html

I have edited these files. The main one being the 404 page which does not seem to work.

again thanks for any help given icon_smile.gif
Yivit
I really don't think you need the .htaccess file. Perhaps that's what is messing things up. I tested it on mine and all I had to do was edit the /home/httpd/vhosts/domain.com/error_docs/not_found.html file (with custom error messages checked in the Setup portion for the domain, of course) and restart Apache.
Zimike
oh trust me I have tried with and without the .htaccess file.
Squire
You mentioned your httpd.include. It won't do any good to edit that one since it gets rewritten constantly.

You can do it with a vhost.conf for that domain. Any edit of this file is going to require a restart of the domain in PSA so that the changes take effect.

Personally, I just put in .htaccess directives and don't fool with anything else since htaccess will override the httpd.include instructions. If you do it this way you'll probably want to keep your error documents inside the httpdocs folder though, since it's going to read short paths starting with /httpdocs/, just like it would with any other htaccess directives. If you want to go above that in the heirarchy you'll want to put in the full path. (ie /home/httpd/vhosts/domain.com/error_docs/somefile.html)

So in conclusion, the easiest way IMHO is to leave httpd.include and even vhost.conf alone. Put your directives in .htaccess and point to files that are inside your httpdocs folder, and give the path from httpdocs. No restart of anything required that way. icon_wink.gif
JLChafardet
custom error pages can be done by the skeleton file...

you just need to create your new skeleton file and under its structure place your error pages, i have done it b4 and works like charm

that will allow your clients to have their own error docs if you allow it when creating the domain.

regards,
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.