主頁(yè) > 知識(shí)庫(kù) > aspx文件格式使用URLRewriter實(shí)現(xiàn)靜態(tài)化變成html

aspx文件格式使用URLRewriter實(shí)現(xiàn)靜態(tài)化變成html

熱門標(biāo)簽:服務(wù)器配置 Mysql連接數(shù)設(shè)置 Linux服務(wù)器 銀行業(yè)務(wù) 科大訊飛語(yǔ)音識(shí)別系統(tǒng) 電子圍欄 阿里云 團(tuán)購(gòu)網(wǎng)站
使用asp.net 開發(fā)的網(wǎng)頁(yè)程序,使用URLRewriter.dll 實(shí)現(xiàn)靜態(tài)化。
A. 下載URLRewriter.rar,解壓后放在/bin/目錄下
B. 將URLRewriter.rar 加入工程引用。
C. 配置IIS 站點(diǎn),將擴(kuò)展名為html 指向處理程序aspnet_isapi.dll。
IIS 站點(diǎn)->屬性->主目錄->配置->添加
可執(zhí)行文件和aspx 處理相同,都是 c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
特別注意,一定不要選擇檢查文件是否存在。
D. 在web.config 中添加配置內(nèi)容,壓縮包里有。
復(fù)制代碼 代碼如下:

configSections>
section name="RewriterConfig"
type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
/configSections>
!-- 實(shí)際重定向-->
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. 加入代碼:
復(fù)制代碼 代碼如下:

IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/([0-9]+).html$ /user.php?user=$1
/IfModule>

C. 如果網(wǎng)站使用通過(guò)虛擬主機(jī)來(lái)定義,請(qǐng)務(wù)必加到虛擬主機(jī)配置文件.htccess 中去,否則可能
無(wú)法使用。
D. 重啟Apache,重新載入配置。
E. 在地址欄輸入[url]http://localhost/1.html[/url] ,實(shí)際指向[url]http://localhost/user.php?user=1[/url]
您可能感興趣的文章:
  • 比較詳細(xì)的Asp偽靜態(tài)化方法及Asp靜態(tài)化探討
  • 不用mod_rewrite直接用php實(shí)現(xiàn)偽靜態(tài)化頁(yè)面代碼
  • 網(wǎng)頁(yè)的HTML靜態(tài)化_網(wǎng)站優(yōu)化之談
  • 通用大型網(wǎng)站頁(yè)面靜態(tài)化解決方案
  • php 靜態(tài)化實(shí)現(xiàn)代碼
  • asp 網(wǎng)站靜態(tài)化函數(shù)代碼html
  • nginx 偽靜態(tài)化rewrite規(guī)則
  • ASP頁(yè)面靜態(tài)化批量生成代碼分享(多種方法)
  • php靜態(tài)化頁(yè)面 htaccess寫法詳解(htaccess怎么寫?)
  • smarty 緩存控制前的頁(yè)面靜態(tài)化原理
  • php頁(yè)碼形式分頁(yè)函數(shù)支持靜態(tài)化地址及ajax分頁(yè)
  • 使用ob系列函數(shù)實(shí)現(xiàn)PHP網(wǎng)站頁(yè)面靜態(tài)化
  • 分享常見的幾種頁(yè)面靜態(tài)化的方法
  • 如何對(duì)ASP.NET網(wǎng)站實(shí)現(xiàn)靜態(tài)化

標(biāo)簽:江蘇 廣元 大理 衡水 蚌埠 衢州 棗莊 萍鄉(xiāng)

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《aspx文件格式使用URLRewriter實(shí)現(xiàn)靜態(tài)化變成html》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266