Server wide custom 404 pages. Possible?

astounding

Member
Aug 11, 2006
8
0
151
Hey,

I intend to use cpanel for free hosting. Hence being able to customize and put ads
on a 404 page is important. (That's one way how free webhosts profit).

Is this possible with cPanel to make the 404 page the same server wide, unless
the member changes it via .htaccess ofcourse ?

Thank you!
Andre
 

sonicdriven

Registered
Mar 18, 2005
2
0
151
You should be able to put your .htaccess and custom error page in the Cpanel Skeleton folder. I Havent tried it but I dont see why it wouldnt work.
 

webignition

Well-Known Member
Jan 22, 2005
1,876
2
166
Another option, although one I've not tried, is to put the relevant ErrorDocument handlers in the main Apache config, within each domain's VirtualHost container.

My reasoning is that if such things work from .htaccess files, surely they should work from the main Apache config since .htaccess files are, to an extent, merely extensions to the main config. I suppose the ErrorDocument handlers would have to go, for each VirtualHost, after the DocumentRoot is specified otherwise things might get confusing.

Leaving things at that, you'd still have the issue whereby users could override these settings in their .htaccess files. However, it's possible to specify, within the main Apache config, what users can/can't do in .htaccess files. I don't recall how nor do I recall to what extent you can control what users can/can't do in .htaccess files, but the potential is there.

If this does actually work it will then have the benefit of preventing users from specifying their own error pages. But, as I said, I haven't tried this at all and it's just a passing thought.
 

SoftDux

Well-Known Member
May 27, 2006
1,023
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
put a .htaccess file, which loads the relevant 404 & other error documents, in each user's public_html folder. For new users, copy the files to /root/cpanel3-skel/public_html - this way it will be copied to all new user's home dirs. Most users don't even know about these pages, or how to edit .htaccess files. The only problem you have with .htaccess, is if a user installs Joomla, or some of the other scripts in Fantastico, Fantastico reports the existance of a .htaccess file, and won't continue untill it's removed.