第一种:web.config伪静态文件(win2008服务器,IIS7.x以上版本)
<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”r1″>
<match url=”^([a-zA-Z0-9/]+)/list_([0-9]+).html$” ignoreCase=”false” />
<action type=”Rewrite” url=”list.php?path={R:1}&p={R:2}” appendQueryString=”false” />
</rule>
<rule name=”r2″>
<match url=”^([a-zA-Z0-9/]+)/([a-z0-9-_]+).html$” ignoreCase=”false” />
<action type=”Rewrite” url=”article.php?path={R:1}/{R:2}.html” appendQueryString=”false” />
</rule>
<rule name=”r3″>
<match url=”^(tag/.+)/$” ignoreCase=”false” />
<action type=”Rewrite” url=”list.php?path={R:1}” appendQueryString=”false” />
</rule>
<rule name=”r4″>
<match url=”^(s/)$” ignoreCase=”false” />
<action type=”Rewrite” url=”search.php” appendQueryString=”true” />
</rule>
<rule name=”r5″>
<match url=”^([a-zA-Z0-9/]+)/$” ignoreCase=”false” />
<conditions logicalGrouping=”MatchAll”>
<add input=”{R:1}” pattern=”^(admin|yysAdmin|yysadmin|s)” ignoreCase=”true” negate=”true” />
</conditions>
<action type=”Rewrite” url=”list.php?path={R:1}” appendQueryString=”false” />
</rule>
<rule name=”r6″>
<match url=”^(sitemap|rss).xml$” ignoreCase=”false” />
<action type=”Rewrite” url=”api/{R:1}.xml.php” />
</rule>
<rule name=”r7″>
<match url=”^([a-zA-Z0-9-]+).html$” ignoreCase=”false” />
<action type=”Rewrite” url=”topic.php?path={R:1}” />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
第二种:.htaccess文件(常见于linux平台,apache服务器)
<FilesMatch ".(bak|inc|lib|sh|tpl|lbi|dwt)$">
order deny,allow
deny from all
</FilesMatch>
RewriteEngine On
RewriteRule ^(s/)$ search.php [L]
RewriteRule ^([a-zA-Z0-9/]+)/([0-9]+).html$ article.php?path=$1/$2.html [L]
#栏目页面排除
RewriteCond $1 !^(admin|yysAdmin|yysadmin|yelangbak|phpMyAdmin|s)
RewriteRule ^([a-zA-Z0-9/]+)/$ list.php?path=$1 [L]
RewriteRule ^([a-zA-Z0-9/]+)/list_([0-9]+).html$ list.php?path=$1&p=$2 [L]
RewriteRule ^(sitemap|rss).xml$ api/$1.xml.php [L]
RewriteRule ^([a-zA-Z0-9-]+).html$ topic.php?path=$1 [L]
当然,不用的服务器环境可能规则会有所变化,目前这两种是比较流行的做法,其他伪静态规则,可以根据这两种规则进行转译。如果您不能操作,可以联系我司客服协助处理。