thinkphp在iis7以上如何配置伪静态隐藏index.php

简介: thinkphp在iis7以上如何配置伪静态隐藏index.php

1.如果iis没有安装url重写模块,先下载url重写模块安装上,下载地址:https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=7435


2.下载安装完成之后,通过iis管理器重启iis,然后重新打开iis管理器,发现增加了url重写


3.iis高版本可以在网站根目录配置web.config,实现url重写,从而达到隐藏index.php的目录,web.config示例内容如下:


<?xml version="1.0" encoding="UTF-8"?>

<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name="Imported Rule 1" stopProcessing="true">

<match url="^(.*)$" ignoreCase="false" />

<conditions logicalGrouping="MatchAll">

<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />

<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />

</conditions>

<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />

</rule>

</rules>

</rewrite>

       <defaultDocument>

           <files>

               <add value="index.php" />

           </files>

       </defaultDocument>

       <handlers>

           <add name="php" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="D:\phpstudy_pro\Extensions\php\php7.3.4nts\php-cgi.exe" resourceType="Unspecified" />

       </handlers>

</system.webServer>

</configuration>


4.需要注意web.config内容,handlers节点下面是php解析器路径,请根据真实情况做出调整。


相关文章
|
4月前
|
关系型数据库 MySQL API
|
30天前
|
PHP
PHP——安装ThinkPHP框架报错
PHP——安装ThinkPHP框架报错
14 0
|
3月前
|
存储 运维 Serverless
函数计算产品使用问题之在YAML文件中配置了环境变量,但在PHP代码中无法读取到这些环境变量,是什么原因
函数计算产品作为一种事件驱动的全托管计算服务,让用户能够专注于业务逻辑的编写,而无需关心底层服务器的管理与运维。你可以有效地利用函数计算产品来支撑各类应用场景,从简单的数据处理到复杂的业务逻辑,实现快速、高效、低成本的云上部署与运维。以下是一些关于使用函数计算产品的合集和要点,帮助你更好地理解和应用这一服务。
|
3月前
|
网络协议
windows_server2012搭建iis并配置http重定向 iis转发
windows_server2012搭建iis并配置http重定向 iis转发
140 1
|
18天前
|
开发框架 .NET 中间件
【Azure 云服务】在Cloud Service的代码中如何修改IIS Application Pool的配置呢? 比如IdleTimeout, startMode, Recycling.PeriodicRestart.Time等
【Azure 云服务】在Cloud Service的代码中如何修改IIS Application Pool的配置呢? 比如IdleTimeout, startMode, Recycling.PeriodicRestart.Time等
【Azure 云服务】在Cloud Service的代码中如何修改IIS Application Pool的配置呢? 比如IdleTimeout, startMode, Recycling.PeriodicRestart.Time等
|
20天前
|
C++
【Azure云服务 Cloud Service】如何在部署云服务Cloud Service时候通过启动任务Start Task来配置IIS (如开启ARR)
【Azure云服务 Cloud Service】如何在部署云服务Cloud Service时候通过启动任务Start Task来配置IIS (如开启ARR)
|
3天前
|
消息中间件 NoSQL Go
PHP转Go系列 | ThinkPHP与Gin框架之Redis延时消息队列技术实践
【9月更文挑战第7天】在从 PHP 的 ThinkPHP 框架迁移到 Go 的 Gin 框架时,涉及 Redis 延时消息队列的技术实践主要包括:理解延时消息队列概念,其能在特定时间处理消息,适用于定时任务等场景;在 ThinkPHP 中使用 Redis 实现延时队列;在 Gin 中结合 Go 的 Redis 客户端库实现类似功能;Go 具有更高性能和简洁性,适合处理大量消息。迁移过程中需考虑业务需求及系统稳定性。
|
1月前
|
前端开发 网络安全 PHP
PHP代码审计之MVC与ThinkPHP简介
PHP代码审计之MVC与ThinkPHP简介
27 2
|
2月前
|
Java API PHP
【亲测有效,官方提供】php版本企查查api接口请求示例代码,php请求企查查api接口,thinkphp请求企查查api接口
【亲测有效,官方提供】php版本企查查api接口请求示例代码,php请求企查查api接口,thinkphp请求企查查api接口
83 1
|
2月前
|
安全 前端开发 API
PHP框架详解 - ThinkPHP框架
PHP框架详解 - ThinkPHP框架