PHPCMS伪静态规则配置

PHPCMS官方默认安装包中已经包含Apache伪静态规则,不过其它WEB需要将规则进行转换,比如IIS

Apache

将官方默认.htaccess文件放到站点根目录即可,内容如下:

RewriteEngine on
RewriteRule ^content-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3
RewriteRule ^show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3
RewriteRule ^list-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=lists&catid=$1&page=$2

IIS 7/IIS 8

如果您使用的IIS,将下面的规则另存为web.config放到站点根目录即可。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
    <rewrite>
  <rules>
    <rule name="Imported Rule 1">
      <match url="^content-([0-9]+)-([0-9]+)-([0-9]+).html" ignoreCase="false" />
      <action type="Rewrite" url="index.php?m=content&amp;c=index&amp;a=show&amp;catid={R:1}&amp;id={R:2}&amp;page={R:3}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 2">
      <match url="^show-([0-9]+)-([0-9]+)-([0-9]+).html" ignoreCase="false" />
      <action type="Rewrite" url="index.php?m=content&amp;c=index&amp;a=show&amp;catid={R:1}&amp;id={R:2}&amp;page={R:3}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 3">
      <match url="^list-([0-9]+)-([0-9]+).html" ignoreCase="false" />
      <action type="Rewrite" url="index.php?m=content&amp;c=index&amp;a=lists&amp;catid={R:1}&amp;page={R:2}" appendQueryString="false" />
    </rule>
  </rules>
</rewrite>
    </system.webServer>
</configuration>

标签: 伪静态 phpcms

发表评论: