1

The website uses the asp.net framework.

The problem is that I have a folder with an index.php as the index page. It only loads if I specify the path as /folder/index.php, but throws up a 403 forbidden if I use just /folder. (/folder works if an index.html is in the folder)

How can this be resolved? I am not at all experienced with asp.net and prefer not to mess with any of the existing config files if possible.

Note: The PHP page loads perfectly fine. The problem is that asp.net is not recognizing the index.php page as an index page.

SOLUTION: I followed EdSF's advice and created a web.config file in that folder with the following inside the config

<configuration>
   <system.webServer>
    <defaultDocument>
        <files>
            <add value="index.php" />
        </files>
    </defaultDocument>
   </system.webServer>
</configuration>
  • First, what makes you think `ASP.Net` (runtime) should understand `php`? It's IIS, not ASP.Net runtime. See @MitchS answer and set IIS to recognize `index.php` as one of the possible *default documents*. For IIS7, [see this](http://blogs.iis.net/bills/archive/2008/03/22/how-to-add-a-default-document-with-iis7-web-config.aspx) – EdSF Nov 06 '12 at 19:47
  • EdSF, that worked. Updated original question with the solution I used. – user1803728 Nov 06 '12 at 20:04

3 Answers3

4

You need to set 'index.php' as a default content page in IIS. How to do this may vary slightly depending what version of IIS you are using.

In IIS6 you go to the web sites properties (via right-click context menu), go to the 'Documents' tab and add them there.

Edit as some of you have asked in comments - below is a guide from Microsoft on setting index.php as a default content page through web.config:

How to add a default document with IIS7 web.config

Mitch Satchwell
  • 4,770
  • 2
  • 24
  • 31
0

see if this thread helps you. I have never tried to run php under asp. I do either or. But apparently it is possible.

Community
  • 1
  • 1
twaldron
  • 2,722
  • 7
  • 40
  • 55
  • The php page loads fine if I define '/folder/index.php', it just throws up a 403 when I type '/folder/'. Seems it is not being recognized as an index page. – user1803728 Nov 06 '12 at 16:46
0
can you do a javascript redirect from index.html 

<script>
window.document.location = "index.php";
</script>
ek_ny
  • 10,153
  • 6
  • 47
  • 60
  • I would prefer not to do a redirect. The page needs to load immediately and without a hitch (users with no javascript won't be able to see content). – user1803728 Nov 06 '12 at 16:45