之前說了我把 DZ7.2 轉換到了 DX1.5,我放在了 Godaddy 的免費空間裡,用的 WIN 主機 IIS7 版本,這樣就沒有另人討厭的廣告了,同時如果安裝 WorPress 的話偽靜態也可以得到解決。
不過我把 DX 傳上去之後發現不能設定偽靜態,因為後臺並沒有提供 IIS7 虛擬主機的偽靜態規則,那就只有在網上搜了,終於在康盛的論壇裡找到了可以用的偽靜態規則,經驗證可以使用,下面是規則
<?xml
version="1.0" encoding="UTF-8"?><configuration>
<system.webServer><rewrite>
<rules><rule name="portal_topic">
<match url="http://topic-(.+).html$" ignoreCase="false"
/><conditions
logicalGrouping="MatchAll"><add
input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
</conditions>
<action type="Rewrite"
url="portal.php?mod=topic&topic={R:1}&{C:1}"
appendQueryString="false" /></rule>
<rule name="portal_article">
<match url="http://article-([0-9]+).html$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{QUERY_STRING}" pattern="^(.*)$"
ignoreCase="false" /></conditions>
<action type="Rewrite"
url="portal.php?mod=view&aid={R:1}&page={page}&{C:1}"
appendQueryString="false" /></rule>
<rule name="forum_forumdisplay">
<match url="http://forum-(w+)-([0-9]+).html$" ignoreCase="false"
/><conditions
logicalGrouping="MatchAll"><add
input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
</conditions>
<action type="Rewrite"
url="forum.php?mod=forumdisplay&fid={R:1}&page={R:2}&{C:1}"
appendQueryString="false" /></rule>
<rule name="forum_viewthread">
<match url="http://thread-([0-9]+)-([0-9]+)-([0-9]+).html$"
ignoreCase="false" /><conditions
logicalGrouping="MatchAll"><add
input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
</conditions>
<action type="Rewrite"
url="forum.php?mod=viewthread&tid={R:1}&extra=page%3D{R:3}&page={R:2}&{C:1}"
appendQueryString="false" /></rule>
<rule name="group_group">
<match url="http://group-([0-9]+)-([0-9]+).html$" ignoreCase="false"
/><conditions
logicalGrouping="MatchAll"><add
input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
</conditions>
<action type="Rewrite"
url="forum.php?mod=group&fid={R:1}&page={R:2}&{C:1}"
appendQueryString="false" /></rule>
<rule name="home_space">
<match url="http://space-(username|uid)-(.+).html$" ignoreCase="false"
/><conditions
logicalGrouping="MatchAll"><add
input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
</conditions>
<action type="Rewrite"
url="home.php?mod=space&{R:1}={R:2}&{C:1}"
appendQueryString="false" /></rule>
<rule name="all_script">
<match url="http://([a-z]+)-(.+).html$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{QUERY_STRING}" pattern="^(.*)$"
ignoreCase="false" /></conditions>
<action type="Rewrite"
url="{R:1}.php?rewrite={R:2}&{C:1}" appendQueryString="false"
/></rule>
</rules></rewrite>
</system.webServer></configuration>
將
以上內容複製,並建立 web.config 檔案,貼上進去,上傳到空間就可以了
經測試如要在門戶文章頁實現偽靜態,就要在後臺把文章門戶頁
的連結格式改為 portal-view-aid-{id}.html 再開戶文章門戶頁的偽靜態才可以,官方預設的連結格式會找不到頁面
這
個規則只適用於 IIS7 虛擬主機安裝的 Discuz X 1.5 版本