沒有ISAPI Rewrite FULL照樣玩多網站偽靜態_win伺服器

來源:互聯網
上載者:User
IIS中增加URL Rewrite功能,最多人選用的是名為“ISAPI Rewrite“的軟體,網上下載的破解版,其實破解不完善,最終會不能用。

再次尋找,找到了Ionic's Isapi Rewrite Filter,完全開源,完全免費,完全沒有中文使用手冊。

測試後,使用正常,用法分享一下:

首先到官方網站http://www.codeplex.com/IIRF/Release/ProjectReleases.aspx或者到雲棲社區下載(http://www.jb51.net/softs/40097.html)下載最新軟體包,注意要下載的是IonicIsapiRewriter-2.0-Release-bin.zip,版本號碼可能會變化。以下安裝僅針對WIN2003+IIS6.0的伺服器環境。

一、安裝IIRF

1、複製IIRF的DLL(IIRF.dll)到相應的檔案夾,如D:\Rewrite。 或者,它可以在一個完全不同的分類樹。 這取決於你。

2、如果您建立一個伺服器全域範圍的設定檔案(IirfGlobal.ini),你必須把它與(IIRF.dll)檔案在同一目錄中。 該URL Rewrite篩選器將尋找其在該檔案中的全域設定檔案。 如果是多個網站,則在網站更目錄下建立(IIRF.dll)檔案。

3、對(IIRF.dll)所在目錄賦予IIS_WPG使用者組“讀取”、“讀取與運行”、“寫入”許可權。

4、 開啟Internet資訊服務管理器。右鍵點擊IIS管理器左欄“網站” 》“屬性”,彈出“網站屬性”選項卡,選擇“ISAPI篩選器”,如下圖添加IIRF。

百度權重查詢 站長交易 友情連結交換 網站建設,網站設計,企業建站就找313

5、重啟IIS

6、右鍵點擊IIS管理器左欄“網站” 》“屬性”,彈出“網站屬性”選項卡,選擇“ISAPI篩選器”,查看“IIRF”載入是否成功。若是綠色向上箭頭,則表示載入成功。

 

二、規則檔案格式基本照搬ISAPI Rewrite,要作修改RewriteRule [源URL正則條件] [目的URL]
ISAPI Rewrite與IIRF的區別就在[目的URL],ISAPI Rewrite的要轉義,而IIRF不用轉義。
如果網上有現成的ISAPI Rewrite的規則可以直接複製過來,將[目的URL]中的反斜線(\)一個個刪除就可以用在IIRF中用了。
知道這個之後,你就可以隨便在網上與人交流,按ISAPI Rewrite交流,最後把轉義符(\)刪掉就行了。

三、日誌設定

在IIRF中日誌值可以設定為0-5,在規則檔案的開頭部分有兩行設定日誌類型
RewriteLog C:\Rewrite\supesite\iirfLog.out (注意要寫清楚路徑,各網站不同)
RewriteLogLevel 0 (0為不記類,3為一般測試,5為處理故障)
日誌的代價高昂,同時不會自動刪除檔案,日誌類型一定要設成0,除非用於檢查才能修改為其他值,檢查完後一定要改為0,否則記錄檔把硬碟佔滿就麻煩了。
如果日誌不為0,篩選器起用後,對應檔案夾會產生類似以下的檔案,是文字格式設定的,可以用記事本查看。
iirfLog.out.12345.log

四、查看配置

在IIRF.ini檔案中輸入以下配置參數,則可通過瀏覽器方便查看目前IIRF配置
StatusUrl iirfStatus
StatusInquiry ON
在瀏覽器中輸入http://localhost/iirfstatus,即可查看。

五、規則檔案可隨時修改,隨時生效!

六、附上wordpress的IIRF規則

先到wordpress後台設定固定串連為:/post/%post_id%.html
然後在wordpress所在網站的根目錄建立(IIRF.ini)檔案,並在檔案中加入以下規則:
複製代碼 代碼如下:

RewriteLogLevel 0
RewriteLog E:\flyingblue\logfiles\IIRFLOG\log
StatusUrl iirfStatus
StatusInquiry ON

RewriteRule /index.html$ /index.php [L]

<ol>
<li>from accessing through HTTP</li>
<li># WordPress rewrite rules#</li>
<li># Below is for permalink like /post/%post_id%.html</li>
<li># Provided By Sideblue</li>
<li># URL:<A href="http://ivup.cn</li>" rel=nofollow>http://ivup.cn</li></A>;
</ol>

RewriteCond %{REQUEST_FILENAME} ^wp-content.*
RewriteCond %{REQUEST_FILENAME} ^wp-admin.*
RewriteCond %{REQUEST_FILENAME} ^wp-include.*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /post/tag/(.*) /index.php\?tag=$1
RewriteRule /tag/(.*) /index.php?tag=$1
RewriteRule /(contact|about-copyright|favor|archives|tags|sitemap) /index.php?pagename=$1
RewriteRule /post/category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?category_name=$1&feed=$2
RewriteRule /post/category/?(.*) /index.php?category_name=$1
RewriteRule /author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?author_name=$1&feed=$2
RewriteRule /author/?(.*) /index.php?author_name=$1
RewriteRule /rss.xml /wp-feed.php?feed=rss2
RewriteRule /feed/?$ /wp-feed.php?feed=rss2
RewriteRule /comments/feed/?$ /wp-feed.php?feed=comments-rss2
<ol>
<li>RewriteRule /([0-9]+)/?([0-9]+)?/?$ /index.php?p=$1&page=$2</li>
<li>RewriteRule /post/([0-9]+)/?([0-9]+)?/?$ /index.php?p=$1&page=$2</li>
</ol>

RewriteRule /post/([0-9]+).html /index.php?p=$1
RewriteRule /page/(.*)/?s=(.*) /index.php?s=$2&paged=$1
RewriteRule /page/(.*) /index.php?paged=$1
RewriteRule /post/date/([0-9]{4})([0-9]{1,2})([0-9]{1,2})/([^/]+)/?([0-9]+)?/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5
RewriteRule /post/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2&day=$3&page=$4
RewriteRule /post/date/([0-9]{4})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2&page=$3
RewriteRule /post/([0-9]+).html/(feed|rdf|rss|rss2|atom) /index.php?feed=rss2&p=$1
RewriteRule /post/([0-9]+).html/trackback /wp-trackback.php?p=$1

來源:ivup.cn

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.