View Full Version : error page
hello. well what i want is to know how to create an error page so that everytime people try to access a page that has been deleted, they get this personalized error page instead of just the regular "this page cannot be displayed"
boogyman
10-15-2007, 06:07 PM
Google is your friend (http://www.google.com/search?source=ig&hl=en&q=htaccess+404&btnG=Google+Search)
djr33
10-15-2007, 06:13 PM
Actually, I think this is something that can be done nicely with PHP.
A 404 error will redirect to a single page based on any page not found.
That won't help much identifying a single file, though.
Using the information in the $_SERVER array, you can create a nice error page.
The info that will help, mostly, is in $_SERVER['REQUEST_URI'].
echo 'We're sorry, but '.$_SERVER['REQUEST_URI'].' was not found.';
Then you could also split the REQUEST URI for the various parts, such as the filename:
<?php
$a = explode('/',$_SERVER['REQUEST_URI']); //split at the slashes
$a = $a[count($a)-1]; //get the last bit (1 back because arrays start at 0)
echo $a; //now the filename
?>
That should get you started.
alexjewell
10-16-2007, 11:14 PM
Eh, you will have to talk to your server's administrator...some servers allow you to upload your own 404 page.
boogyman
10-17-2007, 12:53 PM
Eh, you will have to talk to your server's administrator...some servers allow you to upload your own 404 page.
anyone can upload a 404 page, but as djr was saying that is not very personal / page specific. I made the same mistake but I believe that djr's solution would work well in this case.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.