2026 年 11 月
日一二三四五六123456789101112131415161718192021222324252627282930
当天有发布文章
访客信息
您的 IP 216.73.217.88
浏览器 未知浏览器
您的设备 桌面设备
连接类型 HTTPS · GET
服务语言 未知
当前域名 blog.xoyo.org
站点统计
367文章数目
197评论数目
718累计访问
7312运行天数
封面 加载中…

IIS服务器伪静态全攻略及应用

逍遥花主 1 阅读 『技术文摘』

要使你的IIS服务器支持伪静态重写,按以下步骤来:

1. 安装重写插件Rewrite.dll

点击下载

如果你的 IIS 服务器加载过 Rewrite.dll 则可以不用下载。

加载 Rewrite.dll

在 IIS 的 Isapi 上添加筛选器

筛选器名称为:re

可执行文件选择 Rewrite.dll 就可以了!

2. 配置 httpd.ini
打开你的httpd.ini,找到

[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32

# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^(.*)/archiver/([a-z0-9\-]+\.html)$ $1/archiver/index\.php\?$2
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay\.php\?fid=$2&page=$3
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread\.php\?tid=$2&extra=page\%3D$4&page=$3
RewriteRule ^(.*)/profile-(username|uid)-(.+?)\.html$ $1/viewpro\.php\?$2=$3


以上是 Discuz!官方提供的配置代码,注意正则格式。

3. 应用
比如,将read.php?bl_id=123&bu_id=456 伪静态成 /html/123/456.html

可以这样写:

RewriteRule ^(.*)/html/([0-9]+)/([0-9]+)\.html$ $1/read\.php\?bl_id=$2&bu_id=$3


请举一反三,正则不懂的,可以去网上搜索正则表达式。

暂无评论

发表评论