[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]
记录一下 以备不时只需
Win2k3+iis 下 WordPress 伪静态怎么写?
可在 httpd.ini 的 ISAPI_Rewrite 段里配置重写规则:先放行 tag、静态资源、sitemap、favicon 和 wp 相关路径,再把站点根目录及普通请求统一转到 index.php。这样能兼顾 WordPress 文章链接和资源访问。
为什么要单独放行图片和 wp 目录?
因为 WordPress 主题、后台和附件常依赖这些路径,若全部强制重写,容易导致图片打不开、后台异常或静态文件失效。先放行再重写,是老 IIS 环境里更稳的做法。
这类 httpd.ini 规则适合哪些场景?
适合运行在 Win2k3+iis、使用 ISAPI_Rewrite 的老站点,尤其是想把 WordPress 链接做成伪静态、同时保持静态资源正常访问的场景。配置后建议逐项测试首页、文章页、图片和后台。







发表回复