File does not exist: 404.shtml - How to make it for all accounts?

postcd

Well-Known Member
Oct 22, 2010
717
19
68
Hello, is there any good way on how to create an 404.shtml file for all newly created cpanela ccounts automatically?

I mean one way is to have it added to each account www folder,
then modifying httpd.conf and setting some kind of redirect?

But i need cpanel users to be able to override this redirect..

what is the clever way to solve this? or i should let the errors come in my server httpd error_log file?
 

postcd

Well-Known Member
Oct 22, 2010
717
19
68
Will the mentioned tutorial fix the reported 404 errors while the 404 document is just included instead being physically located in users www folder?
How can user override these 404 by his own?
 

Infopro

Well-Known Member
May 20, 2003
17,113
507
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
Hello, is there any good way on how to create an 404.shtml file for all newly created cpanela ccounts automatically?
Add default files you want all accounts to start out with, to the root/cpanel3-skel/ and/or for reseller, username/cpanel3-skel/ directories to prevent error log cruft.
Skeleton Directory - cPanel Documentation

I like to add a plain txt file as well, explaining what the default files are and how to modify them for the new user. For example:

defaultfiles.png
 

postcd

Well-Known Member
Oct 22, 2010
717
19
68
yes, this i dont want to do. i dont want to add any files to the user accounts if possible. Would be more wise and better to set any global 404.shtml which anyone can override in htaccess or by creating another 404 file?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Will the mentioned tutorial fix the reported 404 errors while the 404 document is just included instead being physically located in users www folder?
How can user override these 404 by his own?
Please ensure you read the full thread that I referenced. Both questions are answered in that thread.

Thanks.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Hello :)

The first post itself explains that a 404 page is not required in every account. It's only required in a single directory:

http://forums.cpanel.net/f5/cpanel-whm-custom-403-page-all-accounts-208702.html#post856912

This next post answers a question that another user had regarding the ability for a user to override these settings. It's at the end of the post:

http://forums.cpanel.net/f5/cpanel-whm-custom-403-page-all-accounts-208702.html#post856951

Please note that reading an entire thread might seem like a tedious task, but it's really the best way to learn new information.

Thank you.
 

postcd

Well-Known Member
Oct 22, 2010
717
19
68
Thanks, so i did it as you described in your post http://forums.cpanel.net/f5/cpanel-whm-custom-403-page-all-accounts-208702.html#post856912

Added this to Pre VirtualHost Include All versions:

Alias /errorfolder /usr/local/apache/customerror/
ErrorDocument 400 /errorfolder/400.shtml
ErrorDocument 401 /errorfolder/401.shtml
ErrorDocument 403 /errorfolder/403.shtml
ErrorDocument 404 /errorfolder/404.shtml
ErrorDocument 500 /errorfolder/500.shtml
i saved & restarted apache

cat /usr/local/apache/customerror/404.shtml
404, Not found
-rw-r--r-- 1 root root 15 Sep 10 18:21 404.shtml

But in user account which is without .htaccess and without php.ini i type to browser: thataccountdomain.com/nonexistingphrasse and it returns:

Not Found

The requested URL /dfdfdfdf was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
So please can You tell why
404, Not found
is not shown?

When i add into virt. host include following code it starts to show:
ErrorDocument 400 "400, Bad request"
ErrorDocument 401 "401, Unauthorized"
ErrorDocument 403 "403, Forbidden"
ErrorDocument 404 "404, Not found"
ErrorDocument 500 "500, Internal server error"
but mentioned code with alias dont work

Thank you
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Feel free to open a support ticket using the link in my signature so we can take a closer look. You can post the ticket number here so we can update this thread with the outcome.

Thank you.