标题 | discuzx1.5 真正的iis7用无错url静态化规则 |
内容 | 首先发下牢骚 ,康盛真的是不咋地,伪静态的设置什么的都不说明,以前7.0时,就不好设置伪静态,因为那时候我用的是win 主机,不支持.htaccess所以就要去找httpd.ini 的。现在的dx1.5提供的到是多了一点,一共提供了6种,并且也提供了iis的伪静态规则 ,不过提供的都是独立主机用的版本,真是不知道该说什么。 之前说了我把dz7.2转换到了dx1.5,我放在了godaddy的免费空间里,用的win主机 iis7 版本,这样就没有另人讨厌的广告了,同时如果安装wowordpress的话伪静态也可以得到解决。不过我把dx传上去之后发现不能设置伪静态,因为后台并没有提供iis7 虚拟主机的伪静态规则,那就只有在网上搜了,终于在康盛的论坛里找到了可以用的伪静态规则,经验证可以使用,下面是规则 代码如下: <?xml version=1.0 encoding=utf-8?> <configuration> <system.webserver> <rewrite> <rules> <rule name=portal_topic> <match url=^topic-(.+)\.html$ ignorecase=false /> <conditions logicalgrouping=matchall> <add input={query_string} pattern=^(.*)$ ignorecase=false /> </conditions> <action type=rewrite url=portal.php?mod=topic&topic={r:1}&{c:1} appendquerystring=false /> </rule> <rule name=portal_article> <match url=^article-([0-9]+)\.html$ ignorecase=false /> <conditions logicalgrouping=matchall> <add input={query_string} pattern=^(.*)$ ignorecase=false /> </conditions> <action type=rewrite url=portal.php?mod=view&aid={r:1}&page={page}&{c:1} appendquerystring=false /> </rule> <rule name=forum_forumdisplay> <match url=^forum-(\w+)-([0-9]+)\.html$ ignorecase=false /> <conditions logicalgrouping=matchall> <add input={query_string} pattern=^(.*)$ ignorecase=false /> </conditions> <action type=rewrite url=forum.php?mod=forumdisplay&fid={r:1}&page={r:2}&{c:1} appendquerystring=false /> </rule> <rule name=forum_viewthread> <match url=^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ ignorecase=false /> <conditions logicalgrouping=matchall> <add input={query_string} pattern=^(.*)$ ignorecase=false /> </conditions> <action type=rewrite url=forum.php?mod=viewthread&tid={r:1}&extra=page\%3d{r:3}&page={r:2}&{c:1} appendquerystring=false /> </rule> <rule name=group_group> <match url=^group-([0-9]+)-([0-9]+)\.html$ ignorecase=false /> <conditions logicalgrouping=matchall> <add input={query_string} pattern=^(.*)$ ignorecase=false /> </conditions> <action type=rewrite url=forum.php?mod=group&fid={r:1}&page={r:2}&{c:1} appendquerystring=false /> </rule> <rule name=home_space> <match url=^space-(username|uid)-(.+)\.html$ ignorecase=false /> <conditions logicalgrouping=matchall> <add input={query_string} pattern=^(.*)$ ignorecase=false /> </conditions> <action type=rewrite url=home.php?mod=space&{r:1}={r:2}&{c:1} appendquerystring=false /> </rule> <rule name=all_script> <match url=^([a-z]+)-(.+)\.html$ ignorecase=false /> <conditions logicalgrouping=matchall> <add input={query_string} pattern=^(.*)$ ignorecase=false /> </conditions> <action type=rewrite url={r:1}.php?rewrite={r:2}&{c:1} appendquerystring=false /> </rule> </rules> </rewrite> </system.webserver> </configuration> 将以上内容复制,并创建web.config文件,粘贴进去,上传到空间就可以了 经测试如要在门户文章页实现伪静态,就要在后台把文章门户页的链接格式改为portal-view-aid-{id}.html 再开户文章门户页的伪静态才可以,官方默认的链接格式会找不到页面 这个规则只适用于iis7 虚拟主机安装的discuzx 1.5版本。 |
随便看 |
|
在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。