服务器伪静态防止.zip/.rar格式文件被下载
服务器伪静态防止.zip/.rar格式文件被下载IIS 环境 web.config文件在根目录
(down.php为提示文字页面)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Feed-G" stopProcessing="true">
<match url="^(+).zip" ></match>
<action type="Rewrite" url="down.php?d={R:1}" ></action>
</rule>
<rule name="Feed-H" stopProcessing="true">
<match url="^(+).rar" ></match>
<action type="Rewrite" url="down.php?d={R:1}" ></action>
</rule>
</rules>
</rewrite>
<httpErrors errorMode="Custom" ></httpErrors>
</system.webServer>
</configuration>
NGINX
(down.php为提示文字页面)
location / {
rewrite ^/(+)\.zip$ /down.php?d=$1 last;
rewrite ^/(+)\.rar$ /down.php?d=$1 last;
}
apache 根目录 .htaccess文件
(down.php为提示文字页面)
RewriteEngine On
RewriteRule ^(.+)\.zip$ /down.php?name=$1
RewriteRule ^(.+)\.rar$ /down.php?name=$1
down.php内容可以是纯html文字,也可以是记录下载记录的代码
页:
[1]