hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Software and Control Panels : .htaccess and 404.shtml (under CPanel)
Reply

Forum Jump

.htaccess and 404.shtml (under CPanel)

Reply Post New Thread In Hosting Software and Control Panels Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 01-08-2003, 09:37 AM
xenoborg xenoborg is offline
Junior Guru Wannabe
 
Join Date: Oct 2002
Posts: 85
Angry

.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



Sponsored Links
  #2  
Old 01-08-2003, 09:59 AM
eHostSpace eHostSpace is offline
Web Hosting Master
 
Join Date: Dec 2002
Posts: 642
i thought you can just input html in one of the sections of cpanel which allows you to edit the error pages ?

__________________
eHostSpace WebHostings
MSN: khimhong@hotmail.com | AIM: valency87
E-Mail: khimhong@ehostspace.com

  #3  
Old 01-08-2003, 10:25 AM
xenoborg xenoborg is offline
Junior 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!

Sponsored Links
  #4  
Old 01-08-2003, 01:15 PM
michaeln michaeln is offline
Web 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/");
?>

  #5  
Old 01-08-2003, 01:29 PM
YUPAPA YUPAPA is offline
Quant Trader
 
Join Date: May 2001
Location: HK
Posts: 3,013
Smile

Easy,

Just create your own .htaccess file for errordocs from SSH or upload it with FTP.

Code:
ErrorDocument	404	/my_404.html
#Note, the above path is not the full server path...

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

  #6  
Old 01-08-2003, 01:56 PM
xenoborg xenoborg is offline
Junior 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?

  #7  
Old 01-08-2003, 05:50 PM
eHostSpace eHostSpace is offline
Web Hosting Master
 
Join Date: Dec 2002
Posts: 642
but why go through all this trouble when actually cpanel has it for you to just enter html codings ?

__________________
eHostSpace WebHostings
MSN: khimhong@hotmail.com | AIM: valency87
E-Mail: khimhong@ehostspace.com

  #8  
Old 01-08-2003, 09:48 PM
bear bear is online now
Community Leader
 
Join Date: Oct 2002
Location: Mayberry
Posts: 19,702
Quote:
Originally 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">
Those are not absolute links.

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.

Reply

Related posts from TheWhir.com
Title Type Date Posted
ResellerZOOM Listing 2013-12-11 23:26:56
cPanel Security Updates Address Perl Module Vulnerabilities Web Hosting News 2012-12-06 12:55:54
Hosting Control Panel cPanel & WHM 11.34 Release Hits Stable Tier Web Hosting News 2012-11-12 17:04:57
cPanel Releases cPanel, WHM 11.34 with New User Interface Web Hosting News 2012-10-16 13:09:49
cPanel Conference 2012: Branding and How to Do it Better with Felipe Gasper Web Hosting News 2012-10-09 18:00:02


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:
WHT Membership
WHT Membership



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?