当前位置: 首页 > 帮助中心 > 云虚机

web.config常见伪静态规则一(thinkphp wrodpress Discuz dedecms)

更新时间 :  2019/12/17 16:45:16

常见的几种伪静态规则(只需要把自己程序对应的伪静态规则复制到web.config 中即可)

thinkphp伪静态

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

<configuration>

  <system.webServer>

    <rewrite>

      <rules>

        <rule name="ThinkPHP_NiPaiYi" 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>

  </system.webServer>

</configuration>

--------------------------------

wrodpress 伪静态

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

<configuration>

  <system.webServer>

    <rewrite>

      <rules>

        <rule name="WordPress" stopProcessing="true">

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

          <conditions>

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

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

          </conditions>

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

        </rule>

      </rules>

    </rewrite>

  </system.webServer>

</configuration>

-------------------------------------------------------

Discuz 伪静态

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

<configuration>

  <system.webServer>

    <rewrite>

      <rules>

        <rule name="portal_topic">

          <match url="^(.*/)*topic-(.+).html\?*(.*)$"/>

          <action type="Rewrite" url="{R:1}/portal.php?mod=topic&topic={R:2}&{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&aid={R:2}&page={R:3}&{R:4}"/>

        </rule>

        <rule name="forum_forumdisplay">

          <match url="^(.*/)*forum-(\w+)-([0-9]+).html\?*(.*)$"/>

          <action type="Rewrite" url="{R:1}/forum.php?mod=forumdisplay&fid={R:2}&page={R:3}&{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&tid={R:2}&extra=page%3D{R:4}&page={R:3}&{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&fid={R:2}&page={R:3}&{R:4}"/>

        </rule>

        <rule name="home_space">

          <match url="^(.*/)*space-(username|uid)-(.+).html\?*(.*)$"/>

          <action type="Rewrite" url="{R:1}/home.php?mod=space&{R:2}={R:3}&{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&uid={R:2}&do=blog&id={R:3}&{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}&value={R:3}&{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}&{R:4}"/>

        </rule>

      </rules>

    </rewrite>

  </system.webServer>

</configuration>

----------------------------------------------------------------------

DEDEcms伪静态

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

<configuration>

  <system.webServer>

    <rewrite>

      <rules>

        <rule name="Imported Rule 1">

          <match url="list-([0-9]+)\.html" ignoreCase="false"/>

          <action type="Rewrite" url="plus/list.php?tid={R:1}" appendQueryString="false"/>

        </rule>

        <rule name="Imported Rule 2">

          <match url="list-([0-9]+)-([0-9]+)-([0-9]+)\.html" ignoreCase="false"/>

          <action type="Rewrite" url="plus/list.php?tid={R:1}&TotalResult={R:2}&PageNo={R:3}" appendQueryString="false"/>

        </rule>

        <rule name="Imported Rule 3">

          <match url="view-([0-9]+)-([0-9]+)\.html" ignoreCase="false"/>

          <action type="Rewrite" url="plus/view.php?arcID={R:1}&pageno={R:2}" appendQueryString="false"/>

        </rule>

      </rules>

    </rewrite>

  </system.webServer>

</configuration>


相关文章