UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  UK Web Hosting | Dedicated Server Windows and Linux VPS Forum > Technical Support > Control Panel Questions

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 26-01-2008, 11:20
Junior Member
 
Join Date: Jan 2008
Location: Stoke-on-Trent
Posts: 11
Default Custom 404 page

I'm having trouble setting up a custom 404 (not found) page.

In the control panel there is a icon for amending error pages and I choose the 404 option. It opens a text editor and at the bottom it says "save as ... 404.shtml". The help files say I can change the extension so I change it to 404.php because I want the 404 page to run a script:

<?php
require 'start.php';
print "<h1>Sorry...... etc ";
require 'end.php';
?>

The reason is that start and end contain the basic setup of the website.

Whatever I do, typing in a non existent page brings up a blank page with:

<!--
-->

Can anyone help?
  #2 (permalink)  
Old 26-01-2008, 11:59
Junior Member
 
Join Date: Jan 2008
Location: Tipton West Mids
Posts: 18
Default

Forget about using cPanel. Write your custom error page and store it somewhere, I use a folder called errors where all my error pages are stored.

Then edit your .htaccess file to relfect this ie add this line:

ErrorDocument 404 /errors/404.php
Don't forget to comment out or delete any referance to 404.shtml if it's present.
  #3 (permalink)  
Old 26-01-2008, 14:35
Junior Member
 
Join Date: Jan 2008
Location: Stoke-on-Trent
Posts: 11
Default

Thanks mdlp. That was easier than using the control panel.

But now I have another problem!

If I browse to a non-existent page like this:

http://www.wooden-heart.co.uk/dud

it works fine. But if I do this:

http://www.wooden-heart.co.uk/dud/ (note the / at the end) it doesn't pick up the css sheet. Also, all the links are now like "..../dud/index.php" (which, of course, doesn't exist).

The file 404.php file requests start.php and end.php. These 3 files are all in the same directory. However, start.php contains the html link to style/default.css which is in the folder called style.

Any idea how to solve?
  #4 (permalink)  
Old 26-01-2008, 14:37
flesso's Avatar
Premium Member
 
Join Date: Mar 2007
Location: 127.0.0.1
Posts: 1,137
Send a message via MSN to flesso Send a message via Skype™ to flesso
Default

You need to add a '/' at the beginning of the paths to all the CSS files. That should fix it.

So:

Quote:
<link rel="alternate stylesheet" type="text/css" media="screen" title="whitered" href="style/whitered.css" />
Would become:

Quote:
<link rel="alternate stylesheet" type="text/css" media="screen" title="whitered" href="/style/whitered.css" />
I've made the added slash bold.
__________________
Regards,
Josh Hold

eUKhost Blog: Over 1000 Computer Related Articles to Sink Your Teeth Into!

Super Moderator

I'm only a moderator, and do not work for eUKhost in any way. Opinions expressed by me are mine only, and do not reflect those of either eUKhost or any company that may be listed above.
  #5 (permalink)  
Old 26-01-2008, 16:37
Junior Member
 
Join Date: Jan 2008
Location: Stoke-on-Trent
Posts: 11
Default

Thanks. I've added / to the start of each link and it works now!
  #6 (permalink)  
Old 26-01-2008, 17:22
Junior Member
 
Join Date: Jan 2008
Location: Tipton West Mids
Posts: 18
Default

Quote:
Originally Posted by paulmann View Post
Thanks. I've added / to the start of each link and it works now!
Glad you've got it sorted

--------------------------------
Cheers Martyn
  #7 (permalink)  
Old 26-01-2008, 17:39
flesso's Avatar
Premium Member
 
Join Date: Mar 2007
Location: 127.0.0.1
Posts: 1,137
Send a message via MSN to flesso Send a message via Skype™ to flesso
Default

Quote:
Originally Posted by paulmann View Post
Thanks. I've added / to the start of each link and it works now!
Glad to hear it.

/thread
__________________
Regards,
Josh Hold

eUKhost Blog: Over 1000 Computer Related Articles to Sink Your Teeth Into!

Super Moderator

I'm only a moderator, and do not work for eUKhost in any way. Opinions expressed by me are mine only, and do not reflect those of either eUKhost or any company that may be listed above.
Closed Thread



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 06:08.

 

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by Web Hosting 3.1.0
Copyright © 2001-2008, eUKhost.com. All rights reserved.

 
Site Map

knowledgebase articles

popular blog categories