本文介紹在IIS6中.net項目偽靜態(tài)重寫路徑的配置方法圖解和示例。
1、右鍵點擊 要設置網(wǎng)站的網(wǎng)站
2、屬性 ——》主目錄 ——》配置——》
3、如右側窗口,找到 .aspx 擴展名——》編輯——》復制 可執(zhí)行文件的路徑——》關閉
4、點擊 添加——》粘貼 剛復制的 可執(zhí)行文件路徑
5、擴展名填寫 .html (如果是 .htm 或者 任意你想要的擴展都可以 前提是以后的應用程序擴展列表里邊沒有該擴展)
6、不選中 確認文件是否存在
7、確定
iis6 web.config 偽靜態(tài)配置方法
1、參數(shù)用()括起來,使用 $1 來獲得參數(shù)。
2、多個參數(shù)的時候使用&分割。
3、把Intelligencia.UrlRewriter.dll添加到bin目錄
<?xml version="1.0"?> <configuration> <configSections> <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/> </configSections> <system.web> <httpModules> <add type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" name="UrlRewriter"/> </httpModules> </system.web> <rewriter> <!--首頁--> <rewrite url="~/default.html$" to="~/default.aspx" processing="stop"/> <!--新聞--> <rewrite url="~/news/list-([A-Za-z0-9-]*).html$" to="~/NewsList.aspx?typeUrl=$1" processing="stop"/> <rewrite url="~/news/list-([A-Za-z0-9-]*)-([0-9]*).html$" to="~/NewsList.aspx?typeUrl=$1&page=$2" processing="stop"/> <!--新聞詳細--> <rewrite url="~/news/([A-Za-z0-9-]*).html$" to="~/NewsDetail.aspx?url=$1" processing="stop"/> </rewriter> </configuration> |