?
Solved

Problem with dynamic 404 error page in php on iis

Posted on 2004-11-24
7
Medium Priority
?
224 Views
Last Modified: 2012-06-21
I am running IIS 5 with php

I want a dynamically generated 404 error page

I definded my 404error.php  page in the custom errors section of my website settings

when i run the page the file is returned but the php scripts do not run. In fact they actually show up as body copy

does any one have any advice?

0
Comment
Question by:mediatimebomb
6 Comments
 
LVL 3

Expert Comment

by:JoshPowell
ID: 12664338
First, does php run at all? (Create a new file with <?php phpinfo(); ?> in it, and make sure it gets run.)

Josh
0
 
LVL 2

Expert Comment

by:alexmay
ID: 12664960
Have you tried defining a normal html page as the error page and putting a simple redirect to the php page on the html page?
0
 

Author Comment

by:mediatimebomb
ID: 12665511
yes php runs and i would rather avoid yet another redirect expecially off the 404 page.

i need to read some variable e.g. what page was called right on the 404 if i pass it in a simple ridirect i cannot do this
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Expert Comment

by:JoshPowell
ID: 12665619
Well, you could

Page 404.html

<script>
window.location = "404.php"
</script>

Page 404.php
<?php
$thepage = $_SERVER['HTTP_REFERER'];
?>
404 page not found, you request page <?php echo($page); ?> and it was not found.. please check the URL and try again, blah blah blah

Because if I remember correctly, the 404 page is not redirected, rather the page requested is re-written with the contents of the 404 page. Thus the referer is still going to be the page requested.

Josh
0
 

Author Comment

by:mediatimebomb
ID: 12843680
I do appreciate the above suggestions but they are not the solution i need for this to work. I do now want to run sripts on this page the purpose of me wanting to run php on the 404 page is to get a dynamic site map on there will links that SEO spiders can crawl. Having a javascript redirect will put a stop to that

thanks
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12865194
PAQed with points refunded (250)

modulo
Community Support Moderator
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month17 days, 1 hour left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question