PHPstudy 安装选择,iis+php组合,如何设置伪静态
时间:2024年02月22日
/来源:网络
/编辑:佚名
找了半天,终于找到解决方案了。
需要在服务器上安装 Url rewrite 组件。
服务器是64位则安装: rewrite_2.0_rtw_x64.exe
备用链接: https://pan.baidu.com/s/1W2_w1Hi_FWzyFvj5ONgUMg 提取码: saf1
下载地址:http://files.cnblogs.com/files/puzi0315/rewrite_2.0_rtw_x64.zip
然后添加 web.config配置文件,放到站点的根目录。
文件内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="portal.php" />
<add value="Default.htm" />
<add value="index.htm" />
<add value="Default.asp" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
<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>
<rule name="plugin">
<match url="^(.*/)*([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id={R:2}:{R:3}&{R:4}" />
</rule>
<rule name="help_list">
<match url="^(.*/)*list-(\w+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=wq_help&cid={R:2}&{R:3}" />
</rule>
<rule name="article_list">
<match url="^(.*/)*articlelist-([0-9]+)-([0-9]+)-([0-9]+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=wq_wechatcollecting&mod=list&classid={R:2}&displayorder={R:3}&page={R:4}&{R:5}" />
</rule>
<rule name="article_view">
<match url="^(.*/)*wechatarticle-([0-9]+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=wq_wechatcollecting&mod=view&articleid={R:2}&{R:3}" />
</rule>
<rule name="wechat_list">
<match url="^(.*/)*wechatlist-([0-9]+)-([0-9]+)-([0-9]+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=wq_wechatshow&mod=list&classid={R:2}&displayorder={R:3}&page={R:4}&{R:5}" />
</rule>
<rule name="wechat_view">
<match url="^(.*/)*wechat-(\w+)-([0-9]+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=wq_wechatshow&mod=view&wid={R:2}&page={R:3}&{R:4}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
用的是discuz的一套伪静态规则。
需要在服务器上安装 Url rewrite 组件。
服务器是64位则安装: rewrite_2.0_rtw_x64.exe
备用链接: https://pan.baidu.com/s/1W2_w1Hi_FWzyFvj5ONgUMg 提取码: saf1
下载地址:http://files.cnblogs.com/files/puzi0315/rewrite_2.0_rtw_x64.zip
然后添加 web.config配置文件,放到站点的根目录。
文件内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="portal.php" />
<add value="Default.htm" />
<add value="index.htm" />
<add value="Default.asp" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
<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>
<rule name="plugin">
<match url="^(.*/)*([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id={R:2}:{R:3}&{R:4}" />
</rule>
<rule name="help_list">
<match url="^(.*/)*list-(\w+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=wq_help&cid={R:2}&{R:3}" />
</rule>
<rule name="article_list">
<match url="^(.*/)*articlelist-([0-9]+)-([0-9]+)-([0-9]+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=wq_wechatcollecting&mod=list&classid={R:2}&displayorder={R:3}&page={R:4}&{R:5}" />
</rule>
<rule name="article_view">
<match url="^(.*/)*wechatarticle-([0-9]+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=wq_wechatcollecting&mod=view&articleid={R:2}&{R:3}" />
</rule>
<rule name="wechat_list">
<match url="^(.*/)*wechatlist-([0-9]+)-([0-9]+)-([0-9]+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=wq_wechatshow&mod=list&classid={R:2}&displayorder={R:3}&page={R:4}&{R:5}" />
</rule>
<rule name="wechat_view">
<match url="^(.*/)*wechat-(\w+)-([0-9]+).html\?*(.*)$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=wq_wechatshow&mod=view&wid={R:2}&page={R:3}&{R:4}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
用的是discuz的一套伪静态规则。
新闻资讯 更多
- 【建站知识】查询nginx日志状态码大于400的请求并打印整行04-03
- 【建站知识】Python中的logger和handler到底是个什么?04-03
- 【建站知识】python3拉勾网爬虫之(您操作太频繁,请稍后访问)04-03
- 【建站知识】xpath 获取meta里的keywords及description的方法04-03
- 【建站知识】python向上取整以50为界04-03
- 【建站知识】scrapy xpath遇见乱码解决04-03
- 【建站知识】scrapy爬取后中文乱码,解决word转为html 时cp1252编码问题04-03
- 【建站知识】scrapy采集—爬取中文乱码,gb2312转为utf-804-03