---
title: "win2k3+iis下wordpress的伪静态设置httpd.ini"
url: "https://yjyj.net/learn/wordpress-learn/1704.html"
author: "小 虾 (生猛大蝦编辑部)"
published_at: "2012-12-07T21:32:20+08:00"
updated_at: "2013-01-04T17:33:20+08:00"
categories: "WordPress 学习"
tags: "isape, Windows排错指南, WordPress优化, WordPress开发, 伪静态"
summary: "本文记录在 Win2k3+iis 环境下为 WordPress 配置 httpd.ini 伪静态的实战写法，重点解决分类、静态资源、站点根目录与 wp 相关路径的重写问题。适合老服务器环境下想让 WordPress URL 更整洁、同时兼顾访问规则与基础防护的站长直接照抄参考。"
source: "生猛大蝦 (https://yjyj.net)"
---

# win2k3+iis下wordpress的伪静态设置httpd.ini

> 来源：[生猛大蝦 (yjyj.net)](https://yjyj.net/learn/wordpress-learn/1704.html) · 作者：小 虾 · 发布时间：2012-12-07

## 30 秒核心看点 (TL;DR)

- 用 httpd.ini 给 WordPress 做伪静态，核心是把请求统一转到 index.php。
- 规则里同时放行图片、sitemap、favicon 和 wp 目录，避免误伤静态资源。
- 这套写法适合 Win2k3+iis 老环境，属于可直接备份留存的实战配置。

```
[ISAPI_Rewrite]
# Defend your computer from some worm attacks
#RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through
RewriteRule /tag/(.*) /index\.php\?tag=$1
RewriteRule /software-files/(.*) /software-files/$1 [L]
RewriteRule /images/(.*) /images/$1 [L]
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
RewriteRule /wap(.*) /wap$1 [L]
# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]
```

 


记录一下 以备不时只需

## 延伸问答与排错指南 (FAQ)

### Win2k3+iis 下 WordPress 伪静态怎么写？
可在 httpd.ini 的 ISAPI_Rewrite 段里配置重写规则：先放行 tag、静态资源、sitemap、favicon 和 wp 相关路径，再把站点根目录及普通请求统一转到 index.php。这样能兼顾 WordPress 文章链接和资源访问。

### 为什么要单独放行图片和 wp 目录？
因为 WordPress 主题、后台和附件常依赖这些路径，若全部强制重写，容易导致图片打不开、后台异常或静态文件失效。先放行再重写，是老 IIS 环境里更稳的做法。

### 这类 httpd.ini 规则适合哪些场景？
适合运行在 Win2k3+iis、使用 ISAPI_Rewrite 的老站点，尤其是想把 WordPress 链接做成伪静态、同时保持静态资源正常访问的场景。配置后建议逐项测试首页、文章页、图片和后台。

---
更多 Linux 运维、WordPress 性能优化、前端工程化、Shopify 独立站与极客折腾指南：[生猛大蝦全站文章归档 (https://yjyj.net/archive)](https://yjyj.net/archive)
