godaddy的windows主机实现伪静态不能使用.htaccess文件,需要在网站根目录下要添加一个web.config文件。文件内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="filer" stopProcessing="true">
<match url="^f([0-9]+)!(.+)" />
<action type="Rewrite" url="web/file.php?id={R:1}&l={R:2}" />
</rule>
<rule name="flashdown" stopProcessing="true">
<match url="^flash([0-9]+)!(.+)" />
<action type="Rewrite" url="web/flash.php?id={R:1}&l={R:2}" />
</rule>
<rule name="reid" stopProcessing="true">
<match url="^(.+)-(.+).html" />
<action type="Rewrite" url="{R:1}.php?id={R:2}" />
</rule>
<rule name="normal" stopProcessing="true">
<match url="^(\w+).html" />
<action type="Rewrite" url="{R:1}.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
其中的rule节点就是伪静态的配置规则。
<rule name="Prevent hotlinking">
<match url="^.*\.(rar|zip|jpg|gif|png)$" ignoreCase="true" />
<conditions>
<add input="{HTTP_REFERER}" pattern="http://www.heycode.com/.*" negate="true" />
<add input="{HTTP_REFERER}" pattern="http://heycode.com/.*" negate="true" />
</conditions>
<action type="Rewrite" url="/404.htm" />
</rule>
还可以加上这么一段,可以屏蔽及文件的外链