Jump to content

Recommended Posts

Posted

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 :huh:

Posted

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. :huh:

 

If not then I guess it doesn't really matter, because it don't work. :(

 

 

Mav

Posted

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.

Posted

I haven't had time to read the whole article, but it looks like cerealkeeler found what we're looking for.

 

Thanks.

Posted

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

Posted

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.

Posted

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

Posted

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.

Posted

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.

Posted

I'll have to give it a try later tonight and see how it works.

 

Thanks,

Mav

Posted

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.

  • 2 weeks later...
Posted
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.

Posted

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! :o

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...