Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Very new to IIS 7, so apologies if this is a simple one.

I've installed Drupal 7 using the Webstart installer on Windows Server 2008 R2. Drupal makes it's own custom 404 and 403 error pages. When I open up Internet Explorer on the server and test these, they work fine.

However, from a remote machine:

  • Testing what should return a custom 404 page (that is the page doesn't exist), I get a blank page in Firefox, and IE shows a 403 "The website declined to show this webpage" when friendly error messages are turned on, and a blank page when they are turned off.
  • Testing what should return a custom 403 page (by visiting the admin area with a non-authenticated user) returns a "Server Error. 403 - Forbidden: Access is denied. " in the IIS style.

I'm guessing this is a permissions problem, but I can't find anything to change.

Any ideas?

Thanks,

Frederik

share|improve this question

1 Answer 1

up vote 0 down vote accepted

The problem is with IIS web.config file for your site.

This article helped me overcome the issue: http://www.evanclosson.com/devlog/iis7httperrorsconfigurationonlockdown.

Have a read for this post on drupal groups: http://groups.drupal.org/node/25421

Otherwise you can use my config file below.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
  <!-- Don't show directory listings for URLs which map to a directory. -->
    <directoryBrowse enabled="false" />
    <rewrite>
      <rules>
        <rule name="Protect files and directories from prying eyes" stopProcessing="true">
          <match url=".(engine|inc|info|install|module|profile|test|po|sh|.sql|postinst.1|theme|tpl(.php)?|xtmpl|svn-base)$|^(code-style.pl|Entries.|Repository|Root|Tag|Template|all-wcprops|entries|format)$" />
          <action type="CustomResponse" statusCode="403" subStatusCode="0" statusReason="Forbidden" statusDescription="Access is forbidden." />
        </rule>
        <rule name="Force simple error message for requests for non-existent favicon.ico" stopProcessing="true">
          <match url="favicon.ico" />
          <action type="CustomResponse" statusCode="404" subStatusCode="1" statusReason="File Not Found" statusDescription="The requested file favicon.ico was not found" />
        </rule>
        <!-- Rewrite URLs of the form 'x' to the form 'index.php?q=x'. -->
        <rule name="Short URLS" stopProcessing="true">
          <match url="^(.*)$" ignoreCase="false" />
          <conditions logicalGrouping="MatchAll">
              <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
              <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />
        </rule>
      </rules>
    </rewrite>
    <httpErrors>
      <remove statusCode="404" subStatusCode="-1" />
      <error statusCode="404" prefixLanguageFilePath="" path="/index.php" responseMode="ExecuteURL" />
      <remove statusCode="403" subStatusCode="-1" />
      <error statusCode="403" prefixLanguageFilePath="" path="/index.php" responseMode="ExecuteURL" />
    </httpErrors>
    <defaultDocument>
      <!-- Set the default document -->
      <files>
        <remove value="index.php" />
        <add value="index.php" />
      </files>
    </defaultDocument>
  </system.webServer>
</configuration>
share|improve this answer
    
Great! The solution was to add errorMode="Detailed" the httpErrors tag. Thanks! –  Frederik Mar 22 '11 at 8:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.