htaccess重写下载链接

时间:2014-11-17 17:20:04

标签: .htaccess mod-rewrite

我尝试重写这个链接的网址,但显示找不到文件

http://storage1.demo.com/download/2014/11/17/abc.zip?h=2de27c3e4b2cba560caca80f6e07ab2a&t=1416244533

这是我的htaccess

RewriteEngine on
RewriteRule ^download/([0-9]+)/([0-9]+)/([0-9]+)/([a-zA-Z0-9_-\.]+)\.zip?h=(.*)&t=([0-9]+) index.php?type=get&y=$1&m=$2&d=$3&packagename=$4&h=$5&t=$6 [NC,L]

1 个答案:

答案 0 :(得分:1)

你可以这样做:

RewriteEngine on
RewriteCond %{QUERY_STRING} h=(.*)&t=([0-9]+)
RewriteRule download/([0-9]+)/([0-9]+)/([0-9]+)/([a-zA-Z0-9_\-\.]+)\.zip$ index.php?type=get&y=$1&m=$2&d=$3&packagename=$4&h=%1&t=%2 [NC,L]

在[]!

中使用\ -