dbarak Posted February 24, 2005 Posted February 24, 2005 Hello, I tried building a custom 404 error page using the control panel, and it doesn't seem to be working. At first, I tried using the framework of the PHP pages we're using and then saving the control panel-generated file as a PHP file, but when typing in a fictional URL, I got this message: Not Found The requested URL /~metrics/test.htm was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. I then tried saving if (through the control panel, and with no PHP includes) as a default SHTML file, and that didn't work -- still got the same error error. I now have bare bones HTML in my 404.shtml file, and I'm still getting the problem with the error page. So... 1. How do I fix it? 2. Can I use a PHP page as a 404 error page? Dave Quote
TCH-Bruce Posted February 24, 2005 Posted February 24, 2005 You can create an error page in any extension if you modify your .htaccess file with a line similar to this. ErrorDocument 404 /404.htm Quote
dbarak Posted February 24, 2005 Author Posted February 24, 2005 Hi Bruce, I couldn't find the .htaccess file using my FTP client, so I created one and it's now in my public_html folder, but it's still not working (getting the same error). This is what I have in the .htaccess file: ErrorDocument 404 /404.php I made sure that there's a PHP file in the same folder. I remember doing this in the past (I'd forgotten about the .htaccess file since then), but I don't remember if it was in the site's root directory or somewhere else. Should the .htaccess file be placed somewhere else? Dave You can create an error page in any extension if you modify your .htaccess file with a line similar to this. ErrorDocument 404 /404.htm <{POST_SNAPBACK}> Quote
dbarak Posted February 24, 2005 Author Posted February 24, 2005 As an added note, I tried placing the .htaccess file outside of the public area. As a second note, as with our current "active" hosting company, once I change the file name to .htaccess from z.htaccess.txt or whatever (required by Windows, apparently), the file is no longer visible from my FTP client. Quote
TCH-Bruce Posted February 24, 2005 Posted February 24, 2005 Since these are Linux servers any files beginning with a "." are considered hidden files. You may need to adjust your FTP client to display hidden files. As for where the file goes I will make an assumption. All your domain content normally resides in the public_html folder. This is where I have my 404.htm file. Also the .htaccess line that I gave you is right out of my .htaccess file for my site. I have never tried using a .php extension for an error but I don't see why it would matter. One thing to ask is has your domain propogated yet? Not sure if that would cause an issue or not but it may. Quote
dbarak Posted February 24, 2005 Author Posted February 24, 2005 Hi Bruce, Actually, I was able to view the file(s) through the control panel file manager. I verified via several tutorial sites that the formatting is correct (spacing, line breaks, etc.). But no, the domain name hasn't propagated yet (haven't started the process -- waiting to finish building our new site). I tried using .shtml, .htm, and .html files as the error pages, and none worked. Since these are Linux servers any files beginning with a "." are considered hidden files. You may need to adjust your FTP client to display hidden files. As for where the file goes I will make an assumption. All your domain content normally resides in the public_html folder. This is where I have my 404.htm file. Also the .htaccess line that I gave you is right out of my .htaccess file for my site. I have never tried using a .php extension for an error but I don't see why it would matter. One thing to ask is has your domain propogated yet? Not sure if that would cause an issue or not but it may. <{POST_SNAPBACK}> Quote
owatagal Posted February 24, 2005 Posted February 24, 2005 dbarak, My error pages are all .php I also don't know if domain propogation has anything to do with it, but I do know I have problems with my FTP program sending .htaccess files in the wrong mode. I'm too lazy to edit the configuration files, so I do all my .htaccess work through CPanel's File Manager. My guess is that if you uploaded the .htaccess through your FTP program, and it sent it in the wrong mode, you're seeing the file in File Manager but the server can't read it (because it's corrupted or whatever happens when FTP transfer is done in the wrong mode). Delete it in File Manager and then recreate it (again, in File Manager) and see if that solves the problem. File Manager *does* handle .htaccess in the correct mode. Otherwise, see if it fixes itself when the domain propogates. But the fact that it's PHP shouldn't affect anything at all. Quote
TCH-Bruce Posted February 24, 2005 Posted February 24, 2005 Sorry it's taken so long to get back to you. The 404 error page will not funtion properly until you access a page with your domain name. 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.