phpstudy 安装选择,iis+php组合,如何设置伪静态

简介: 如题。 找了半天,终于找到解决方案了。 需要在服务器上安装 Url rewrite 组件。 服务器是64位则安装: rewrite_2.0_rtw_x64.exe  然后添加 web.config配置文件,放到站点的根目录。

如题。

找了半天,终于找到解决方案了。

需要在服务器上安装 Url rewrite 组件。

服务器是64位则安装: rewrite_2.0_rtw_x64.exe

 然后添加 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&amp;topic={R:2}&amp;{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&amp;aid={R:2}&amp;page={R:3}&amp;{R:4}" />
        </rule>
        <rule name="forum_forumdisplay">
            <match url="^(.*/)*forum-(\w+)-([0-9]+).html\?*(.*)$" />
            <action type="Rewrite" url="{R:1}/forum.php\?mod=forumdisplay&amp;fid={R:2}&amp;page={R:3}&amp;{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&amp;tid={R:2}&amp;extra=page%3D{R:4}&amp;page={R:3}&amp;{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&amp;fid={R:2}&amp;page={R:3}&amp;{R:4}" />
        </rule>
        <rule name="home_space">
            <match url="^(.*/)*space-(username|uid)-(.+).html\?*(.*)$" />
            <action type="Rewrite" url="{R:1}/home.php\?mod=space&amp;{R:2}={R:3}&amp;{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&amp;uid={R:2}&amp;do=blog&amp;id={R:3}&amp;{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}&amp;value={R:3}&amp;{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}&amp;{R:4}" />
        </rule>

<rule name="help_list">
            <match url="^(.*/)*list-(\w+).html\?*(.*)$" />
            <action type="Rewrite" url="{R:1}/plugin.php\?id=wq_help&amp;cid={R:2}&amp;{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&amp;mod=list&amp;classid={R:2}&amp;displayorder={R:3}&amp;page={R:4}&amp;{R:5}" />
        </rule>
        <rule name="article_view">
            <match url="^(.*/)*wechatarticle-([0-9]+).html\?*(.*)$" />
            <action type="Rewrite" url="{R:1}/plugin.php\?id=wq_wechatcollecting&amp;mod=view&amp;articleid={R:2}&amp;{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&amp;mod=list&amp;classid={R:2}&amp;displayorder={R:3}&amp;page={R:4}&amp;{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&amp;mod=view&amp;wid={R:2}&amp;page={R:3}&amp;{R:4}" />
        </rule>

    </rules>
</rewrite>
    </system.webServer>
</configuration>
View Code

我用的是discuz的一套伪静态规则。

相关文章
|
2月前
|
安全 PHP
从建站到拿站 -- PHP(Cookie设置)
从建站到拿站 -- PHP(Cookie设置)
20 0
|
3月前
|
程序员 网络安全 PHP
IIS使用PHPManager发布PHP网站
PHPManager是一款用于IIS(Internet Information Services)的工具,旨在简化在Windows服务器上发布PHP网站的过程。通过PHPManager,用户可以轻松管理PHP版本、配置PHP设置以及进行PHP应用程序的部署。这个工具提供了直观的用户界面,使用户能够更方便地与IIS服务器进行交互,而不需要深入了解服务器配置的技术细节。PHPManager的使用使得在IIS环境中托管和维护PHP网站变得更加便捷,提高了网站的部署效率和管理灵活性。
34 0
|
3月前
|
网络安全 PHP 开发者
IIS服务器发布PHP网站
IIS服务器,相信开发者都不会陌生,它的英文全称是Internet Information Services,是由微软公司提供的基于运行Microsoft Windows的互联网基本服务,常用于Windows系统的Web项目部署,本篇以PHP项目为例,讲解如何使用IIS完成PHP项目的发布。
56 0
|
6月前
|
Serverless
函数计算,php7.2内置运行时是单并发吗?为什么设置不了并发数?
函数计算,php7.2内置运行时是单并发吗?为什么设置不了并发数?
61 2
|
1月前
|
PHP 数据安全/隐私保护
PHP页面如何实现设置独立访问密码
PHP网页如果需要查看信息必须输入密码,验证后才可显示出内容的代码如何实现? 对某些php页面设置单独的访问密码,如果密码不正确则无法查看内容,相当于对页面进行了一个加密
12 2
PHP页面如何实现设置独立访问密码
|
7月前
|
PHP Windows
PHP 错误日志设置 - MAC
PHP 错误日志设置 - MAC
88 0
|
3月前
|
Windows
Windows11 安装IIS的步骤
Windows11 安装IIS的步骤
90 0
|
3月前
|
前端开发 PHP
IIS发布PHP网站常见错误:字体库404
笔者最近在用IIS发布php网站时,前端出现了字体库文件404的错误,关于这个问题,尝试了很多办法,最终发现是字体文件类型不被IIS识别导致的,解决方法是在config文件中添加映射配置,下面我就来详细介绍下。
32 5
|
4月前
|
存储 JavaScript 前端开发
百度搜索:蓝易云【php设置和获取Cookie教程。】
需要注意的是,为了确保在向浏览器发送任何输出之前设置Cookie,应该在 `<html>`标签之前或PHP脚本的顶部设置Cookie。
74 0
|
4月前
|
小程序 PHP Perl
vscode设置php自定义注释格式
写代码一般的注释都是有格式的,方便自己和他人阅读代码,多人开发的时候,也能更快的找到这部分代码是由谁来编写的。 好的代码注释确实是一个好习惯,但是,有的时候就是这玩意有敲起来有点费劲~
86 0