1.IIS服务器的配置文件
1.1 web.Config 文件的配置
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="OrgPage" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(.*)$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
2.Apache 服务器的配置文件
2.1 .htaccess 文件的配置
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
ThinkPHP项目地址:
本文详细介绍了IIS服务器中web.Config文件的配置方法及Apache服务器中.htaccess文件的配置方式,这两种配置主要用于实现URL重写功能。通过具体实例展示了如何使用条件判断将所有请求重定向到index.php文件中。
6798

被折叠的 条评论
为什么被折叠?



