0

我在这里有一个令人沮丧的问题。不太确定是什么原因造成的。我的 Drupal 站点在带有 IIS 7 的 Windows 服务器上运行。当我转到http://example.com/admin页面时,我收到 403 错误。但是,如果我使用http://example.com/?q=user登录,然后转到 /admin 它工作正常。我猜测 IIS 中的设置有问题,或者某种权限有问题。我网站的根目录中没有管理目录,所以它不是流氓文件夹搞砸的情况。有任何想法吗??

这是我的 web.config..

<?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|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$" />
          <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>
            <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" />
            <!--<add input="{REQUEST_URI}" pattern="^/(gallery2|message-boards)" 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" />
    </httpErrors> 
    -->



    <defaultDocument>
      <!-- Set the default document -->
      <files>
        <remove value="index.php" />
       <add value="index.php" />
      </files>
    </defaultDocument>
       <staticContent>
            <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
        </staticContent>
   </system.webServer>
</configuration>
4

1 回答 1

0

/?q=user 表示您没有启用干净的 URL。

尝试通过导航到 /?q=admin 登录。然后确保您在站点的根目录中有 .htaccess(它是隐藏的,因此您必须在您使用的任何平台上启用“查看隐藏文件”)。

一旦你确定它在那里——如果没有重新下载 Drupal,隐藏文件可见以获取文件——清除缓存,转到“配置”->“搜索和元数据”->“清理 URL”-> 启用

于 2013-03-19T05:15:22.900 回答