how to custom 403,404,500 page for all accounts?i want to do it on server wide by cPanel/WHM. i want to do it on server side, to all the accounts on the server not a single user. thank you.
how to custom 403,404,500 page for all accounts?i want to do it on server wide by cPanel/WHM. i want to do it on server side, to all the accounts on the server not a single user. thank you.
Hello
This can be achieved by creating an alias for "/errorfolder" in the /usr/local/apache/conf/httpd.conf file via the following steps:
1) Create a directory in /usr/local/apache to store your custom error messages. In this case, I have named the directory "customerror":
2) Ensure your custom error pages have been added to this directory (400.shtml, 404.shtml, etc).Code:mkdir /usr/local/apache/customerror
3) In Web Host Manager, browse to:
"WHM Main >> Service Configuration >> Apache Configuration >> Include Editor"
4) Select "All Versions" under "Pre Virtual Host Include".
5) Add the following to the text box:
6) Click "Update", and then click "Restart Apache".Code: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
Your custom error pages will now be used by default.
Thank you![]()
cPResources: Support Options - Submit a ticket here - Additional Support Options - Forums Search - Mailing Lists - Documentation - Migration Services
-- cPanelMichael - Migration Specialist, Technical Analyst, cPanel Technical Support
1) Create a directory in /usr/local/apache to store your custom error messages. In this case, I have named the directory "customerror":
how to do this? and how to upload the error pages which created by me to the customerror file?
if the user want to overrite the error pages? could he overrite those error pages by his cpanel or .hactess. many thanks.
Hello
Assuming you have root access to the server, this can be done via the command line using the command provided in my last response:1) Create a directory in /usr/local/apache to store your custom error messages. In this case, I have named the directory "customerror":
how to do this? and how to upload the error pages which created by me to the customerror file?
More information on accessing your server via SSH can be found at:Code:mkdir /usr/local/apache/customerror
SSH/Shell Access
The easiest method to create the files within this directory would likely be to create them through a command line text editor:
If you are not familiar with using "vi", feel free to use the text editor of your choice (e.g. nano or pico)Code:vi /usr/local/apache/customerror/404.shtml
Yes, this can be achieved via "cPanel -- Advanced - Error Pages":if the user want to overrite the error pages? could he overrite those error pages by his cpanel or .hactess.
Error Pages
Thank you.
cPResources: Support Options - Submit a ticket here - Additional Support Options - Forums Search - Mailing Lists - Documentation - Migration Services
-- cPanelMichael - Migration Specialist, Technical Analyst, cPanel Technical Support
many thanks,cPanelMichael . you made me know a lot. if i want to add some css and image in the 404.shtml. where should i put the image in, and how to upload the images which will be used on the 404.shtml?
i am sorry i am a newbie. can i write the css code in vi for the 404.shtml.
could i name it to 404.html not 404.shtml?
Hello
You can simply create an images directory within your error log directory. EX:
You can upload the images via SFTP/SCP, or upload them to an account via FTP and move them to the directory through the command line using the "mv" command.Code:mkdir /usr/local/apache/customerror/images
You can insert or edit CSS code into the error page using "vi" if you prefer, yes. If you want to name it 404.html, remember to update the entry used during steps 3-5 from my initial reply to:
Thank you.Code:ErrorDocument 404 /errorfolder/404.html
cPResources: Support Options - Submit a ticket here - Additional Support Options - Forums Search - Mailing Lists - Documentation - Migration Services
-- cPanelMichael - Migration Specialist, Technical Analyst, cPanel Technical Support
i have created the images according to the code which you told me. when i used the FileZilla Client tool with user root and whose password via SFTP to upload the images. i didn't find the images file that i created in vi. i see some files eg:root->csf/public_ftp/cpanel3-skel...and so on. how could i can find the images file.
Hello
The images would be located in the directory you uploaded them to. You can not edit or create an image using a text editor such as "vi". You have to upload them to the directory, which if you used the example provided would be:
/usr/local/apache/customerror/images
Thank you.
cPResources: Support Options - Submit a ticket here - Additional Support Options - Forums Search - Mailing Lists - Documentation - Migration Services
-- cPanelMichael - Migration Specialist, Technical Analyst, cPanel Technical Support
i am sorry, but when i access my WHM via SFTP with root, i can't find this directorythe directoy i found like this:Code:/usr/local/apache/customerror/images
i can't find the customerror/images file, so i don't know where should i upload my images to and how in vi to invoke it.eg:root
csf
public_ftp
cpanel3-skel..
....and so on
how to write the image path and the background image path?Code:<img src=""> background:url(".....")...;
Hello
You mentioned using FileZilla. In Filezilla, where it lists "Remote Site" on the right hand side, you can manually enter a directory such as:
/usr/local/apache
As for coding the page using HTML, the following URL should be useful for that:
HTML Tutorial
Thank you.
cPResources: Support Options - Submit a ticket here - Additional Support Options - Forums Search - Mailing Lists - Documentation - Migration Services
-- cPanelMichael - Migration Specialist, Technical Analyst, cPanel Technical Support
got it. i find i don't necessary to code it.i can upload the file to customerror file directory. many many thanks!
oh,damn it. the directory is as this:
the 404 page can' invoke the image and style.css. why? when i access a user's site which is on my server and doesn't overwrite the 404 page. the 404 page show no style and images,Code:/usr/local/apache/customerror/images /usr/local/apache/customerror/404.shtml style.css
Check the permissions on the files and folders you've put in place.
Hello,
Custom error pages applied to every user account. But how to allow users to make their own error pages in this case? I'd like my error pages to be defined only for accounts who didn't make such pages.
Thanks for reply on advance.