Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> 關於伺服器

IIS URL Rewrite 篩選器快速安裝與配置入門

編輯:關於伺服器

為 IIS 6.0 添加 URL Rewrite 能力,需安裝第三方 ISAPI 篩選器。本文提供最精簡的安裝配置步驟,適用於快速驗證、測試環境部署。

組件獲取

下載 ISAPI Rewrite 組件 (原文鏈接已失效,建議從官方渠道獲取):

安裝步驟

  1. 將解壓文件夾放置任意位置 (如 C:\ISAPI_Rewrite\)
  2. 設置 NTFS 權限:授予 IIS_WPG (IIS 6.0) 或 IIS_IUSRS (IIS 7+) 「讀取/執行」權限
  3. IIS 管理器 → 目標站點右鍵 → 「屬性」 → 「ISAPI 篩選器」標籤 → 「添加」
  4. 彈出對話框填寫:
    • 篩選器名稱:rewrite (部分版本要求固定名稱)
    • 可執行文件:瀏覽選中 ISAPI_Rewrite.dll (或 Rewrite.dll)
  5. 確定 → 重啟 IIS:iisreset 或「網站」右鍵「停止/啟動」

驗證測試

  1. 站點根目錄創建測試配置文件 (httpd.conf 3.x / httpd.ini 2.x)
  2. 添加簡單規則:
    # 3.x httpd.conf
    RewriteEngine On
    RewriteRule ^test\.html$ /default.asp [L]
  3. 瀏覽器訪問 https://site/test.html 應內部重寫至 default.asp (地址欄不變)

進階配置提示

  • 配置文件路徑:組件安裝目錄下 (httpd.conf/httpd.ini),或指定自定義路徑 (部分版本支持註冊表/環境變量指定)
  • 日誌調試:啟用 RewriteLog、RewriteLogLevel (2.x) / LogLevel (3.x) 排查規則匹配問題
  • 多站點隔離:站點級添加篩選器,各站點使用獨立配置文件 (修改註冊表 ConfigFilePath 值)
現代替代方案:IIS 7.0+ (Windows Server 2008+) 內建 URL Rewrite Module 2.0+,通過 web.config 原生配置,無需第三方 ISAPI,性能更優、功能更全、管理更便捷。強烈建議升級至 IIS 7+ 環境。
Copyright © Windows教程網 All Rights Reserved