0

I have a certain PHP file on my windows server in a directory that requires you to add index.php in order to view it.

The below works: http://example.org/placestorun/index

But the following does not work: http://example.org/placestorun/

I added a web.config file to the places to run directory to make it work without the index.php using the below code in the folder's web.config file:

<configuration>
   <system.webServer>
    <defaultDocument>
        <files>
            <add value="index.php" />
        </files>
    </defaultDocument>
   </system.webServer>
</configuration>

The above is not working though.

sjw0525
  • 329
  • 2
  • 17

2 Answers2

1

I ended up just doing a rewrite in web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule placestoswim" stopProcessing="true">
                    <match url="^$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
sjw0525
  • 329
  • 2
  • 17
0

You need to add clear to remove all the inherited elements:

<configuration>
   <system.webServer>
    <defaultDocument enabled="true">
        <files>
            <clear />
            <add value="index.php" />
        </files>
    </defaultDocument>
   </system.webServer>
</configuration>

Also make sure your app is not running in classic mode but in integrated mode.

Peter Bartels
  • 1,474
  • 1
  • 12
  • 20