IIS 7.5 PHP how to redirect when page not found

Hi guys, i am trying to figure out how to have IIS redirect to a URL when its trying to execute a PHP document that is not found. The 404 error page gets executed for everything except when it comes to PHP.

I would assume its because it is the PHP engine that has control here but i dont know where to edit it.

all it tells me is

"no input file specified"

how do i configure PHP to execute a url if page is not found?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shreedhar EtteCommented:
tim_carterAuthor Commented:
What you send me is just how to redirect with PHP scripting. That is not my problem. My problem is the actual php document does not exist that the search engine is trying to locate. no document. no php to execute
Dave BaldwinFixer of ProblemsCommented:
Here is some info: http://technet.microsoft.com/en-us/library/cc771076%28WS.10%29.aspx   I've never had to do this but it seems to be kind of complicated to me.  If you search for IIS7 custom 404 http://www.google.com/search?q=IIS7+custom+404 , there is a lot of info.
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

tim_carterAuthor Commented:
None of those articles applies to PHP on IIS 7.5 which seems to be the problem.
Dave BaldwinFixer of ProblemsCommented:
Oops, I reread your question.  That happens on my computer too.  I'll get back to you if I find something more useful.
tim_carterAuthor Commented:
But like i said. I allready did a redirect on the response code 404. and it works for everything except. PHP documents that does not exist.

see if i do this


then it redirects to the 404 custom error page because ofcourse that path does not exist

but if i exetuce


it just gives me, "no input file specified"

but this works


it redirects.
Dave BaldwinFixer of ProblemsCommented:
There are some comments and links on this page http://us.php.net/manual/en/install.windows.php about the "No input file" problem.
tim_carterAuthor Commented:
It seems the feature is lacking in IIS 7.5 where you can tell IIS not to execute PHP if the file is does not exist in the first place. PHP is just telling you it cant find the file. But IIS should not execute PHP in the first place, since the document does not exist.
Dave BaldwinFixer of ProblemsCommented:
Here is the general info for PHP on IIS7: http://learn.iis.net/page.aspx/24/running-php-applications-on-iis/  There is a section on "Improving error messages" and this may help: http://learn.iis.net/page.aspx/765/improve-php-error-messages-in-iis-7-and-above/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tim_carterAuthor Commented:
Thanks Dave.

Switch to the IIS Manager. If it is closed, click Start, and then select Internet Information Services (IIS) Manager.

2. In the tree view on the left, click the server node.

3. Under IIS, double-click Handler Mappings to edit the PHP handler mapping.

4. Right-click the PHP via FastCGI entry, and then click Edit.

5. Click Request Restrictions.

6. Select the Invoke handler only if request is mapped to check box.

7. Leave the File option button selected.

8. Click OK twice.

9. Click Yes in the Edit Module Mapping dialog box.

This worked
Dave BaldwinFixer of ProblemsCommented:
Cool, glad to help.  I find IIS7 fairly confusing but that's mostly because it requires so much more detail to admin it.
tim_carterAuthor Commented:
thats true, especially after they did the new 7.5 everything is so different now
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.