Fix OwnCloud .htaccess warning in IIS

Fix OwnCloud .htaccess warning in IIS

After much searching I’ve found a solution for the warning –
Security Warning
Your data directory and your files are probably accessible from the internet. The .htaccess file that ownCloud provides is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root.

The issue stems from OwnCloud’s not continuing support for windows server installs.  Linux uses .htaccess for settings and iis uses web.config.

Create a new configuratin file named web.config then paste the following code into the document and save in your data directory.  Delete all .htaccess files.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Imported Rule 1" stopProcessing="true">
          <match url="^(.*)$" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

Leave a Reply