logo

(PHP)JTBC3.0windows系统下伪静态参考

2025-02-19 点击 4

我的操作系统是:windows / mysql5.7

部署了SSL便有个web.config文件,

希望给有需要的朋友一些借鉴。照此方式我负责的几个站点都已经成功。


先到/common/incfiles/lib/jtbc/route.inc.php

63行处 $urltype = base::getNum(tpl::take('global.' . $genre . ':config.urltype', 'cfg'), 0);

此代码里 改0为1


再改web.config文件(此文件是放在根目录下的)。


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

<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name="301_cn" stopProcessing="true">

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

<conditions logicalGrouping="MatchAll">

<add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" ></add>

<add input="{HTTP_HOST}" pattern="^你的域名.com$" />

</conditions>

<action type="Redirect" url="https://你的域名.com/{R:1}" redirectType="Permanent" ></action>

</rule>

————————上面是SSL部署的原代码,下面添加伪静态规则的代码————————

<rule name="re1">

<match url="^index.html$" ignoreCase="false" />

<action type="Rewrite" url="index.php" />

</rule>

<rule name="re2">

<match url="^web.html$" ignoreCase="false" />

<action type="Rewrite" url="web.php" />

</rule>

<rule name="re3">

<match url="^aboutus.html$" ignoreCase="false" />

<action type="Rewrite" url="aboutus.php" />

</rule>

<rule name="re4">

<match url="^aboutus/detail-(.[0-9]*).html$" ignoreCase="false" />

<action type="Rewrite" url="aboutus/index.php?type=detail&amp;id={R:1}" appendQueryString="false" />

</rule>

<rule name="re5">

<match url="^aboutus/detail-(.[0-9]*)-(.[0-9]*).html$" ignoreCase="false" />

<action type="Rewrite" url="aboutus/index.php?type=detail&amp;id={R:1}&amp;page={R:2}" appendQueryString="false" />

</rule>

<rule name="re6">

<match url="^case/detail-(.[0-9]*).html$" ignoreCase="false" />

<action type="Rewrite" url="case/index.php?type=detail&amp;id={R:1}" appendQueryString="false" />

</rule>

<rule name="re7">

<match url="^case/detail-(.[0-9]*)-(.[0-9]*).html$" ignoreCase="false" />

<action type="Rewrite" url="case/index.php?type=detail&amp;id={R:1}&amp;page={R:2}" appendQueryString="false" />

</rule>

<rule name="re8">

<match url="^case/list-(.[0-9]*).html$" ignoreCase="false" />

<action type="Rewrite" url="case/index.php?type=list&amp;category={R:1}" appendQueryString="false" />

</rule>

<rule name="re9">

<match url="^case/list-(.[0-9]*)-(.[0-9]*).html$" ignoreCase="false" />

<action type="Rewrite" url="case/index.php?type=list&amp;category={R:1}&amp;page={R:2}" appendQueryString="false" />

</rule>

<rule name="re10">

<match url="^news/detail-(.[0-9]*).html$" ignoreCase="false" />

<action type="Rewrite" url="news/index.php?type=detail&amp;id={R:1}" appendQueryString="false" />

</rule>

<rule name="re11">

<match url="^news/detail-(.[0-9]*)-(.[0-9]*).html$" ignoreCase="false" />

<action type="Rewrite" url="news/index.php?type=detail&amp;id={R:1}&amp;page={R:2}" appendQueryString="false" />

</rule>

<rule name="re12">

<match url="^news/list-(.[0-9]*).html$" ignoreCase="false" />

<action type="Rewrite" url="news/index.php?type=list&amp;category={R:1}" appendQueryString="false" />

</rule>

<rule name="re13">

<match url="^news/list-(.[0-9]*)-(.[0-9]*).html$" ignoreCase="false" />

<action type="Rewrite" url="news/index.php?type=list&amp;category={R:1}&amp;page={R:2}" appendQueryString="false" />

</rule>

<rule name="re14">

<match url="^contactus.html$" ignoreCase="false" />

<action type="Rewrite" url="contactus.php" />

</rule>

<rule name="re15">

<match url="^consult.html$" ignoreCase="false" />

<action type="Rewrite" url="consult.php" />

</rule>

————————配置规则到此,下面是SSL部署的原代码————————

</rules>

</rewrite>

</system.webServer>

</configuration>


来源原JTBC论坛,作者七郎

0%