第一步,设置web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="article">
<match url="^article-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+).html$" />
<action type="Rewrite" url="article.php?fid={R:1}&aid={R:2}&rand={R:3}&page={R:4}"/>
</rule>
</rules>
</rewrite>
<httpErrors errorMode="Custom">
<remove statusCode="404" />
<error statusCode="404" path="404.php" responseMode="ExecuteURL"/>
</httpErrors>
</system.webServer>
</configuration>另外在404.php中设置如下,不然访问是200代码
<?php
require_once("index.php");
header("status: 404 not found");
exit();
?>我上面是包含了一个首页index.php,你也可以用其他的页面。

