aspx文件格式使用URLRewriter實現(xiàn)靜態(tài)化變成html
更新時間:2013年04月10日 17:29:52 作者:
如何隱藏aspx文件格式,變成html,使用asp.net 開發(fā)的網(wǎng)頁程序,使用URLRewriter.dll 實現(xiàn)靜態(tài)化,接下來將介紹下具體操作步驟,感興趣的朋友可以參考下
使用asp.net 開發(fā)的網(wǎng)頁程序,使用URLRewriter.dll 實現(xiàn)靜態(tài)化。
A. 下載URLRewriter.rar,解壓后放在/bin/目錄下
B. 將URLRewriter.rar 加入工程引用。
C. 配置IIS 站點,將擴展名為html 指向處理程序aspnet_isapi.dll。
IIS 站點->屬性->主目錄->配置->添加
可執(zhí)行文件和aspx 處理相同,都是 c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
特別注意,一定不要選擇檢查文件是否存在。
D. 在web.config 中添加配置內(nèi)容,壓縮包里有。
<configSections>
<section name="RewriterConfig"
type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<!-- 實際重定向-->
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/(\d*).html</LookFor>
<SendTo>~/user/default.aspx?link=$1</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<system.web>
<!--
需要在IIS 里面增加html 引用,改成aspx 的引用
-->
<httpHandlers>
<add verb="*" path="*.aspx"
type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*.html"
type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
E. 在地址欄輸入[url]http://localhost/1.html[/url] 指向[url]http://localhost/user/default.aspx?link=1[/url]
基于Apache HTTP Server 靜態(tài)化Apache Web Server 的配置(conf/httpd.conf )
A. 在httpd.conf 文件中查找LoadModule rewrite_module modules/mod_rewrite.so
通常該行被注釋,去掉“#”。如果沒有就增加該行。
B. 加入代碼:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/([0-9]+).html$ /user.php?user=$1
</IfModule>
C. 如果網(wǎng)站使用通過虛擬主機來定義,請務必加到虛擬主機配置文件.htccess 中去,否則可能
無法使用。
D. 重啟Apache,重新載入配置。
E. 在地址欄輸入[url]http://localhost/1.html[/url] ,實際指向[url]http://localhost/user.php?user=1[/url]
A. 下載URLRewriter.rar,解壓后放在/bin/目錄下
B. 將URLRewriter.rar 加入工程引用。
C. 配置IIS 站點,將擴展名為html 指向處理程序aspnet_isapi.dll。
IIS 站點->屬性->主目錄->配置->添加
可執(zhí)行文件和aspx 處理相同,都是 c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
特別注意,一定不要選擇檢查文件是否存在。
D. 在web.config 中添加配置內(nèi)容,壓縮包里有。
復制代碼 代碼如下:
<configSections>
<section name="RewriterConfig"
type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<!-- 實際重定向-->
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/(\d*).html</LookFor>
<SendTo>~/user/default.aspx?link=$1</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<system.web>
<!--
需要在IIS 里面增加html 引用,改成aspx 的引用
-->
<httpHandlers>
<add verb="*" path="*.aspx"
type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*.html"
type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
E. 在地址欄輸入[url]http://localhost/1.html[/url] 指向[url]http://localhost/user/default.aspx?link=1[/url]
基于Apache HTTP Server 靜態(tài)化Apache Web Server 的配置(conf/httpd.conf )
A. 在httpd.conf 文件中查找LoadModule rewrite_module modules/mod_rewrite.so
通常該行被注釋,去掉“#”。如果沒有就增加該行。
B. 加入代碼:
復制代碼 代碼如下:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/([0-9]+).html$ /user.php?user=$1
</IfModule>
C. 如果網(wǎng)站使用通過虛擬主機來定義,請務必加到虛擬主機配置文件.htccess 中去,否則可能
無法使用。
D. 重啟Apache,重新載入配置。
E. 在地址欄輸入[url]http://localhost/1.html[/url] ,實際指向[url]http://localhost/user.php?user=1[/url]
您可能感興趣的文章:
- 比較詳細的Asp偽靜態(tài)化方法及Asp靜態(tài)化探討
- 不用mod_rewrite直接用php實現(xiàn)偽靜態(tài)化頁面代碼
- 網(wǎng)頁的HTML靜態(tài)化_網(wǎng)站優(yōu)化之談
- 通用大型網(wǎng)站頁面靜態(tài)化解決方案
- php 靜態(tài)化實現(xiàn)代碼
- asp 網(wǎng)站靜態(tài)化函數(shù)代碼html
- nginx 偽靜態(tài)化rewrite規(guī)則
- ASP頁面靜態(tài)化批量生成代碼分享(多種方法)
- php靜態(tài)化頁面 htaccess寫法詳解(htaccess怎么寫?)
- smarty 緩存控制前的頁面靜態(tài)化原理
- php頁碼形式分頁函數(shù)支持靜態(tài)化地址及ajax分頁
- 使用ob系列函數(shù)實現(xiàn)PHP網(wǎng)站頁面靜態(tài)化
- 分享常見的幾種頁面靜態(tài)化的方法
- 如何對ASP.NET網(wǎng)站實現(xiàn)靜態(tài)化
相關文章
ASP.NET Core文件壓縮常見使用誤區(qū)(最佳實踐)
本文給大家分享ASP.NET Core文件壓縮常見的三種誤區(qū),就每種誤區(qū)給大家講解的非常詳細,是項目實踐的最佳紀錄,對ASP.NET Core文件壓縮相關知識感興趣的朋友一起看看吧2021-05-05.NET或.NET Core Web APi基于tus協(xié)議實現(xiàn)斷點續(xù)傳的示例
這篇文章主要介紹了.NET或.NET Core Web APi基于tus協(xié)議實現(xiàn)斷點續(xù)傳的示例,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2020-11-11ASP.NET MVC DropDownList數(shù)據(jù)綁定及使用詳解
DropDownList 控件用于創(chuàng)建下拉列表。DropDownList 控件中的每個可選項都是由 ListItem 元素定義的!該控件支持數(shù)據(jù)綁定2012-12-12Asp.Net+XML操作基類(修改,刪除,新增,創(chuàng)建)
更新內(nèi)容: 1,根據(jù)父節(jié)點屬性讀取字節(jié)點值 2,根據(jù)節(jié)點屬性讀取子節(jié)點值(較省資源模式)2008-07-07