选择伪静态模板确定后会在站点根目录生成一个伪静态规则配置文件web.config,不同的模板伪静态规则不太一样[1],根据需要修改规则网站即可使用伪静态,以ecshop模板为例,下边是修改后的配置文件:
代码如下 | 复制代码 |
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="1" stopProcessing="true"> <match url="^about\.html$" ignoreCase="true" /> <action type="Rewrite" url="about/index.asp" /> </rule> <rule name="2" stopProcessing="true"> <match url="^news\/(\d+)\.html$" ignoreCase="true" /> <action type="Rewrite" url="view/index.asp?id={R:1}.asp" /> </rule> </rules> </rewrite> </system.webServer> </configuration> |
dz论坛
代码如下 | 复制代码 |
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="portal_topic"> <match url="^(.*/)*topic-(.+).html\?*(.*)$" /> <action type="Rewrite" url="{R:1}/portal.php\?mod=topic&topic={R:2}&{R:3}" /> </rule> <rule name="portal_article"> <match url="^(.*/)*article-([0-9]+)-([0-9]+).html\?*(.*)$" /> <action type="Rewrite" url="{R:1}/portal.php\?mod=view&aid={R:2}&page={R:3}&{R:4}" /> </rule> <rule name="forum_forumdisplay"> <match url="^(.*/)*forum-(\w+)-([0-9]+).html\?*(.*)$" /> <action type="Rewrite" url="{R:1}/forum.php\?mod=forumdisplay&fid={R:2}&page={R:3}&{R:4}" /> </rule> <rule name="forum_viewthread"> <match url="^(.*/)*thread-([0-9]+)-([0-9]+)-([0-9]+).html\?*(.*)$" /> <action type="Rewrite" url="{R:1}/forum.php\?mod=viewthread&tid={R:2}&extra=page%3D{R:4}&page={R:3}&{R:5}" /> </rule> <rule name="group_group"> <match url="^(.*/)*group-([0-9]+)-([0-9]+).html\?*(.*)$" /> <action type="Rewrite" url="{R:1}/forum.php\?mod=group&fid={R:2}&page={R:3}&{R:4}" /> </rule> <rule name="home_space"> <match url="^(.*/)*space-(username|uid)-(.+).html\?*(.*)$" /> <action type="Rewrite" url="{R:1}/home.php\?mod=space&{R:2}={R:3}&{R:4}" /> </rule> <rule name="home_blog"> <match url="^(.*/)*blog-([0-9]+)-([0-9]+).html\?*(.*)$" /> <action type="Rewrite" url="{R:1}/home.php\?mod=space&uid={R:2}&do=blog&id={R:3}&{R:4}" /> </rule> <rule name="forum_archiver"> <match url="^(.*/)*(fid|tid)-([0-9]+).html\?*(.*)$" /> <action type="Rewrite" url="{R:1}/index.php\?action={R:2}&value={R:3}&{R:4}" /> </rule> </rules> </rewrite> </system.webServer> </configuration> |
说明:选择伪静态模板不是说网站就得使用这套程序,例如上边选择ecshop模板但网站实际是一个asp企业站。
时间: 2024-10-06 05:59:43