Results 1 to 8 of 8
-
01-08-2003, 09:37 AM #1Junior Guru Wannabe
- Join Date
- Oct 2002
- Posts
- 85
.htaccess and 404.shtml (under CPanel)
I'm wondering how CPanel custom 404 error pages are implemented technically. I suppose, there should be a line in the .htaccess file, something like this (can't remember exactly):
ErrorRedirect 404 http://www.mydomain.com/404.shtml
And the CPanel should add this line automatically. But the problem is that I simply can't find the .htaccess file! I tried to find it using the File Manager in the CPanel, but found nothing. I also tried to logon via SSH client (putty), browsed through all the folders, and again didn't find it.
So how are the CPanel 404 redirects implemented if there's no .htaccess file? Or maybe I should look for it somewhere else? Thanks
-
01-08-2003, 09:59 AM #2Web Hosting Master
- Join Date
- Dec 2002
- Posts
- 640
i thought you can just input html in one of the sections of cpanel which allows you to edit the error pages ?
-
01-08-2003, 10:25 AM #3Junior Guru Wannabe
- Join Date
- Oct 2002
- Posts
- 85
Yes, I can use the CPanel 'Custom Error Pages' section to do that. All of my error pages are currently set up this way, but I've run into a problem: These pages are shown incorrectly when a user requests a missing file from a subfolder, not from the root folder of the site -- pictures and CSS aren't visible, and the page looks horrible. This happens because all paths to pictures and CSSs in my 404.shtml are relative, not absolute.
I don't want to use absolute paths to pictures in the 404.shtml, and would prefer to simply redirect it to another page, say 404err.htm, which could be placed in the root site folder.
Currently, I'm redirecting from their default 404.shtml to my own error page using the meta refresh tag with no timeout, but I think there should be a way to do this from the server side (using .htaccess) -- it should work faster than the meta-refresh.
Please, please help me find that .htaccess file!
-
01-08-2003, 01:15 PM #4Web Hosting Master
- Join Date
- Nov 2001
- Posts
- 857
The information isn't stored in the .htaccess file. It is stored in /usr/local/apache/conf/httpd.conf using alias tags.
The best way to do it is to set absolute links ie. <img src="/images/image.gif"> instead of <img src="images/image.gif">
Regards,
Michael<?
header("Location: http://www.hostevolve.com/");
?>
-
01-08-2003, 01:29 PM #5Web Hosting Master
- Join Date
- May 2001
- Location
- HK
- Posts
- 3,082
Easy,
Just create your own .htaccess file for errordocs from SSH or upload it with FTP.
Code:ErrorDocument 404 /my_404.html
If you are looking for that .htaccess, just write a script to search for .htaccess under your home directory OR find your file from SSH... i am sure there is a command to do that...
-
01-08-2003, 01:56 PM #6Junior Guru Wannabe
- Join Date
- Oct 2002
- Posts
- 85
>The information isn't stored in the .htaccess file.
>It is stored in /usr/local/apache/conf/httpd.conf using alias tags.
Michael, can I override these settings using .htaccess placed in the root site folder? I'm concerned that doing this could break CPanel's own 404 settings -- should I worry?
-
01-08-2003, 05:50 PM #7Web Hosting Master
- Join Date
- Dec 2002
- Posts
- 640
but why go through all this trouble when actually cpanel has it for you to just enter html codings ?
-
01-08-2003, 09:48 PM #8Originally posted by michaeln
The best way to do it is to set absolute links ie. <img src="/images/image.gif"> instead of <img src="images/image.gif">
Document relative: "../images/image.gif" or "images/image.gif"
Root relative: "/images/image.gif"
Absolute links would be "http://www.domain.com/images/image.gif".
Hope that helps.