Mav2u Posted June 1, 2003 Posted June 1, 2003 Okay, I was wondering if I can do a 404.php error page instead of the 404.shtml page? I have a intresting code I would like to try out, but it doesn't seem to work when I saved it as the 404.php. I did have a custom 404 error page from earlier, does that make a difference. Maybe the .shtml version needs to be deleted first or something? I don't know, any help on this would be appreciated. Mav Quote
Lianna Posted June 1, 2003 Posted June 1, 2003 Based solely on this thread I'd say, No. Surefire is the php whizkid around here. If there's a way to make it work, he would probably know. Quote
Mav2u Posted June 1, 2003 Author Posted June 1, 2003 ahh, man! This script I got is very nice and would help out tremendously any web admin here. Very nice error reporting proggie! Assuming I can get it to work! So if I can get it to work I will share it with everyone. If not then I guess it doesn't really matter, because it don't work. Mav Quote
surefire Posted June 1, 2003 Posted June 1, 2003 This is something I've never tried before. But I bet we can figure it out. Why don't you do this... go over to the scripting forum and start a thread by stating your question and posting your php code for the page (if you don't mind). That way, I can see what you're trying to do. This will also require modifying htacess either directly or through the cpanel. I don't see why a custom error page couldn't be php... but others seem to think that it can't. I'd like to give it a shot. I'll research it a little bit and get back to you. Quote
TCH-Sales Posted June 1, 2003 Posted June 1, 2003 http://www.onlamp.com/pub/a/onlamp/2003/02...davidsklar.html Found that page via a quick Google search on the issue, might come in handy for ya'll. Quote
surefire Posted June 2, 2003 Posted June 2, 2003 I haven't had time to read the whole article, but it looks like cerealkeeler found what we're looking for. Thanks. Quote
Mav2u Posted June 2, 2003 Author Posted June 2, 2003 Okay, does anyone know how to change the error pages so that they point to a .php file instead of the .shtml file when I do a custom 404 error page? I see that cpanel automatically saves it as a 404.shtml file but I want a 404.php file. surefire has been helping me a little but he has left town for a little spell. Basically all I need to know is how I can change the server settings to look for a 404.php instead of a 404.shtml. Mav Quote
darkwoof Posted June 2, 2003 Posted June 2, 2003 I think its possible, my website uses PHP files for error pages. I simple edited the htaccess file to point to my php files instead of the shtml ones. I experimented with the files because I wanted my error pages to have a consistent look with the rest of the site (same layout, color scheme, etc.), and the best way to do it was to use PHP includes like the rest of my pages. Strangely, however, I haven't been able to get the error 401 one to work. The other errors seems to work alright though. Quote
Mav2u Posted June 2, 2003 Author Posted June 2, 2003 Okay, how does one edit the .htaccess file and which one and where is it? I need some explaining, I haven't had the luxury of playing with all the stuff on apache before. I need a who, what, where, explanation please. Thanks, Mav Quote
TCH-JimE Posted June 2, 2003 Posted June 2, 2003 Hi, Well I learn something new everyday! Now off to burn the book which lied to me!!! Apologies all! Jim Quote
darkwoof Posted June 2, 2003 Posted June 2, 2003 For me, I edited the .htaccess file found in my public_html (document root) directory. You could use CPanel's File Manager to access and edit the file. In CPanel, click on File Manager (near top of screen). In the File Manager, click on the picture of the folder beside "public_html". Now look for the ".htaccess" file. Click on the text link of it. On the right side of the screen, there should be some options listed. Click on "Edit File". In the editor area, you should be able to edit the content of the ".htaccess" file. Edit the ErrorDocument entries (if existing) to point to the respective *.PHP error pages, or add in new ones (if empty). When you're done, click on the "Save" button at the bottom of the screen. The file should look something like this: ErrorDocument 400 http://www.******/400.php ErrorDocument 401 http://www.******/401.php ErrorDocument 403 http://www.******/403.php ErrorDocument 404 http://www.******/404.php ErrorDocument 500 http://www.******/500.php Hope this helps. You might want to take note that it might not be the best idea to use PHP for error pages, especially just in case for some strange reason PHP fails, LOL~ Even though I use them myself, for technical reasons, simple standard HTML error pages might be better. Quote
matman Posted June 2, 2003 Posted June 2, 2003 I'd agree about not using PHP for error pages in the case of 500-series errors, since these involve processing errors on the server and can actually be caused by PHP. For 404 errors it should not be a problem to use PHP. Quote
Mav2u Posted June 2, 2003 Author Posted June 2, 2003 I'll have to give it a try later tonight and see how it works. Thanks, Mav Quote
buddingchef Posted June 3, 2003 Posted June 3, 2003 Can anyone help me create a custom error page.....period? lol I go to it on my CPanel, but what are all those buttons for? TIA Deb Quote
KevinW Posted June 3, 2003 Posted June 3, 2003 (edited) Click here to go to the TCH Help page with a link to learn how to create a custom error page. Click here to view the sparse CPanel documentation on the subject! -kw Edited June 3, 2003 by kweilbacher Quote
buddingchef Posted June 3, 2003 Posted June 3, 2003 Thanks. I did read the page at the first URL. I know what to put on the page, just don't know how to create it from CPanel This link http://www.cpanel.net/docs/cp/errorPages.htm gets a 404~!! The requested URL /docs/cp/generalJS.js was not found on this server. LOL! But thanks NEway, I'll try and muddle thru it Deb Quote
Lianna Posted June 3, 2003 Posted June 3, 2003 Deb, After reviewing the link I PM'd you, if you still have problems, post back here. I may get a break later this afternoon where I can help ya out. Quote
jonestx Posted June 13, 2003 Posted June 13, 2003 Okay, does anyone know how to change the error pages so that they point to a .php file instead of the .shtml file when I do a custom 404 error page? I see that cpanel automatically saves it as a 404.shtml file but I want a 404.php file. surefire has been helping me a little but he has left town for a little spell. Basically all I need to know is how I can change the server settings to look for a 404.php instead of a 404.shtml. Mav Okay, does anyone know how to change the error pages so that they point to a .php file instead of the .shtml file when I do a custom 404 error page? Sure, this is easy. Assuming you want to do a custom error code for your entire site, browse to your public_html directory with File Manager and locate the .htaccess file. Add a line to .htaccess like this: ErrorDocument 404 /404.php This assumes that 404.php is also in your public_html directory, if it's stored elsewhere you'll need to do a full relative path to it. Quote
Mav2u Posted June 13, 2003 Author Posted June 13, 2003 Yeah, I tried the script, it worked good until it reported every error. Apparently Gallery photo script causes some sort of temporary error which makes the script email me everytime someone accesses the photo pages. Boy was my email full that day! Adding the line to the .htaccess worked great, but I need to look over the script and see what was going on with the false reports with Gallery Photo album script. Thanks for all the help, once again Rock Sign Mav Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.