htaccess重定向与多个参数

时间:2015-11-09 08:05:31

标签: php .htaccess

我想配置.htaccess来重定向网址:

  

http://domain.com/banners/images/?id=123&name=johnmartin&filename=17700_120X600.png

到新网址:

  

http://domain.com/uploads/image/17700_120X600.png

我尝试配置如下:

 RedirectMatch 301 ^/banners/images/?id=$1&name=$2&filename=$3    /uploads/image/$3

但它没有运行。 我怎么解决它?

1 个答案:

答案 0 :(得分:0)

要匹配查询字符串,您需要使用mod_rewrite:

MatOfByte byteMat = new MatOfByte();
Imgcodecs.imencode(".bmp", mat, byteMat);
return new Image(new ByteArrayInputStream(byteMat.toArray()));

对于动态查询字符串值,请尝试

RewriteEngine On

RewriteCond %{QUERY_STRING} ^id=123&name=johnmartin&filename=17700_120X600.png$ [NC]
RewriteRule ^banners/images/?$  http://domain.com/uploads/image/17700_120X600.png [NC,QSA,L,R]