开发者

.htaccess rewrite remote image location

with .htaccess below i can rewrite image location from http//mysite/folder/test.jpg to http//mysite/test.jpg

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^pic.jpg /folder/pic.jpg

but when i tried with remote site

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^img.jpg http/remotesite/img.jpg

i can't rewrite it to http//mysite/img.jpg because its redir开发者_JS百科ected to original location and my question is, it is possible to rewrite remote image location with .htaccess?

thanks

SOLVED

using php readfile()

 <?php
 header("Content-Type: image/jpeg");
 $img = $_GET['img'];
 $url =  "http://remote/image.php?img=".$img;
 readfile("$url");
 ?> 

and .htaccess

RewriteEngine on
RewriteBase /
RewriteRule ^(*.jpg)$ images.php?img=$1[L]


Options +FollowSymlinks
RewriteEngine On
RewriteRule ^img.jpg http://remotesite/img.jpg
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜