在GoDaddy windows主機上安裝過wordpress的都知道,會出現500錯誤,但怎么解決這個GoDaddy windows主機500錯誤呢?花了好幾個小時的時間,搜索了相關的教材,通過調試,發現以下方案能很好解決GoDaddy windows主機出現的500錯誤。方法就是通過web.config文件來解決。另外附上利用web.config進行wordpress偽靜態的代碼。
通過創建或修改web.config文件使之顯示詳細的錯誤。注意在wordpress根目錄下上傳以下內容的web.config文件。
代碼1:(適用于GoDaddy Windows IIS6的web.config代碼)
<!-- Web.Config Configuration File --><configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
代碼2:Windows IIS7的用戶使用下面的代碼:
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
設置404錯誤頁面
使用web.config文件也可以配置顯示錯誤面
其中的mycustompage.htm是你想設置的錯誤頁面
代碼:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="On" default Redirect="mycustompage.htm"/>
</system.web>
</configuration>
另外,Linux主機出現500 internal server error 500錯誤的可以參考下下面的方法:
在服務器控制面板中 選擇Settings>>File Extension>>Default Extension 列表里有個.php 然后編輯,選擇php5.x(默認的是php5.x FastCGI) 保存。
另外如何還不能解決,就到控制面板error log里也會有錯誤日志,分析下具體什么原因。
利用web.config對wordpress進行偽靜態設置:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
下一篇 在GD中輸出漢字的函數