mediatimebomb
asked on
Problem with dynamic 404 error page in php on iis
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?
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?
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?
ASKER
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
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
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
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
ASKER
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
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Josh