Re: 404 Redirection
| From: | mike cullerton | Date: | Sun, 13 Jan 2002 14:51:24 +0000 |
| Subject: | Re: 404 Redirection | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80355@lists.php.net to get a copy of this message | ||
on 1/13/02 6:07 AM, FiShcAkE at lee.osborne@lineone.net wrote:
> Try that again, without pressing ctrl-enter this time!!
>
> As I said, I have got the usual script:
>
> <?
> if(isset($action))
> {
> $include = $action;
> } else {
> $include = "home";
> }
> include($include. ".inc");
> ?>
>
> but, how do I put in a custom error page instead of seeing:
if i understand what you are asking, you might try something like
if (is_file($include. ".inc")) {
include($include. ".inc");
} else {
include(custom_error.inc);
}
you may need to execute is_file($include. ".inc") inside a loop so that it
checks in all your inlude_directories.
foreach($dirs as $dir) {
if (is_file($dir.'/'.$include. ".inc")) {
blahblahblah
}
otherwise, if you know 'all' the valid files, you could create an array of
filenames and compare $include to elements of the array.
>
> Warning: Unable to access anyotherpage.inc in
> /var/virt/home/stuffwefound-co-uk/public_html/index.php on line 70
>
> Warning: Failed opening 'anyotherpage.inc' for inclusion (include_path='')
> in
> /var/virt/home/stuffwefound-co-uk/public_html/index.php on line 70
>
> I have got an error page for any other url i.e. apagenotfound.php but I
> dont know how to overcome the above.
>
> Thanks in advance
>
> Lee
>
-- mike cullerton michaelc at cullerton dot com