ThinkPHP在不同系统下的伪静态规则汇总

建网站  2021-01-09  1386 次浏览  ThinkPHP伪静态规则TP伪静态

建企业网站时离不了CMS系统,其中基于ThinkPHP(TP)框架的系统占绝大多数。ThinkPHP是一个快速、兼容而且简单的轻量级国产PHP开发框架,诞生于2006年初,原名FCS,2007年元旦正式更名为ThinkPHP,遵循Apache2开源协议发布,从Struts结构移植过来并做了改进和完善,同时也借鉴了国外很多优秀的框架和模式,使用面向对象的开发结构和MVC模式,融合了Struts的思想和TagLib(标签库)、RoR的ORM映射和ActiveRecord模式。

ThinkPHP伪静态规则

一、在Nginx下的伪静态规则,一般命名Nginx.conf

location / {
   if (!-e $request_filename) {
   rewrite  ^(.*)$  /index.php?s=/$1  last;
   break;
    }
 }

二、在Apache下的伪静态规则, 一般命名.htaccess

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
</IfModule>

三、在Windows的IIS下的伪静态规则,一般命名web.Config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="OrgPage" stopProcessing="true">
                    <match url="^(.*)$" ></match>
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTP_HOST}" pattern="^(.*)$" ></add>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" ></add>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" ></add>
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:1}" ></action>
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>



本文地址:ThinkPHP在不同系统下的伪静态规则汇总 https://www.371jianzhan.com/technical/175.html


上一篇: 在网页制作中合理应用网页边框的样式属性

下一篇: 在网站SEO优化中常用的搜索引擎指令有哪些?

最新信息
推荐信息
建企业网站
建企业网站