Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

IIS 7.5 PHP how to redirect when page not found

Posted on 2012-04-10
13
626 Views
Last Modified: 2012-06-27
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?
0
Comment
Question by:tim_carter
  • 6
  • 6
13 Comments
 
LVL 34

Expert Comment

by:Shreedhar Ette
ID: 37828583
0
 
LVL 1

Author Comment

by:tim_carter
ID: 37828599
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
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37828655
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.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 1

Author Comment

by:tim_carter
ID: 37828721
None of those articles applies to PHP on IIS 7.5 which seems to be the problem.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37828802
Oops, I reread your question.  That happens on my computer too.  I'll get back to you if I find something more useful.
0
 
LVL 1

Author Comment

by:tim_carter
ID: 37828820
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

www.mydomain.com/fiwejf0jf9i23

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

but if i exetuce

www.mydomain.com/fiwejf0jf9i23/test.php

it just gives me, "no input file specified"

but this works

www.mydomain.com/fiwejf0jf9i23/test.htm

it redirects.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37828852
There are some comments and links on this page http://us.php.net/manual/en/install.windows.php about the "No input file" problem.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37828867
0
 
LVL 1

Author Comment

by:tim_carter
ID: 37828916
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.
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 37828953
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/
0
 
LVL 1

Author Comment

by:tim_carter
ID: 37828973
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
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37829024
Cool, glad to help.  I find IIS7 fairly confusing but that's mostly because it requires so much more detail to admin it.
0
 
LVL 1

Author Comment

by:tim_carter
ID: 37829038
thats true, especially after they did the new 7.5 everything is so different now
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

792 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