2016-03-10 44 views
0

所以標題說明了它。我只是無法讓web.config文件工作。如果有人知道我在這裏做錯了,這將是很好的。 http_error_handler.php在url中獲取請求並根據該請求顯示錯誤。嘗試使用IIS創建自定義錯誤頁面(服務器正在使用php)

的web.config

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <defaultDocument> 
      <files> 
       <remove value="index.php" /> 
       <add value="index.php" /> 
      </files> 
     </defaultDocument> 
     <httpErrors> 
      <clear /> 
      <remove statusCode="403" subStatusCode="-1"></remove> 
      <remove statusCode="404" subStatusCode="-1"></remove> 
      <remove statusCode="405" subStatusCode="-1"></remove> 
      <remove statusCode="408" subStatusCode="-1"></remove> 
      <remove statusCode="500" subStatusCode="-1"></remove> 
      <remove statusCode="502" subStatusCode="-1"></remove> 
      <remove statusCode="504" subStatusCode="-1"></remove> 
      <error statusCode="403" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error> 
      <error statusCode="404" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error> 
      <error statusCode="405" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error> 
      <error statusCode="408" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error> 
      <error statusCode="500" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error> 
      <error statusCode="502" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error> 
      <error statusCode="504" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error> 
     </httpErrors> 
    </system.webServer> 
    <system.web> 
     <customErrors mode="On"> 
      <error statusCode="403" redirect="/php/handlers/http_error_handler.php?status=403"></error> 
      <error statusCode="404" redirect="/php/handlers/http_error_handler.php?status=404"></error> 
      <error statusCode="405" redirect="/php/handlers/http_error_handler.php?status=405"></error> 
      <error statusCode="408" redirect="/php/handlers/http_error_handler.php?status=408"></error> 
      <error statusCode="500" redirect="/php/handlers/http_error_handler.php?status=500"></error> 
      <error statusCode="502" redirect="/php/handlers/http_error_handler.php?status=502"></error> 
      <error statusCode="504" redirect="/php/handlers/http_error_handler.php?status=504"></error> 
      </customErrors> 
     </system.web> 
    </configuration> 

回答

0

的內容替換

<httpErrors> 

<httpErrors errorMode="Custom"> 
相關問題