本地代理并不总是有效

时间:2015-03-12 23:55:20

标签: php apache .htaccess redirect proxy

我制作了一个代码作为HTTP代理脚本,但我以另一种形式使用它。当我尝试打开时,我有一些需要重定向的链接。

例如:如果我尝试打开http://www.example.com/myfile.exe,则会提供302并使用http://special.site/url?=http://www.example.com/myfile.exe重定向。

好的是它在Firefox中工作正常但它不能在IDM(互联网下载管理器)中工作它只是显示404错误并显示消息“找不到对象”,之后我尝试将所有工作放入.htaccess非常好,因为它在单个.htaccess中完成所有工作。

我的.htaccess代码详情:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteCond %{REQUEST_URI} !^/index.php[nc]
RewriteRule ^(.+)$ http://localhost/directdl/?url=http://%{HTTP_HOST}%{REQUEST_URI} [r=302,QSA,nc]

详细信息 - 尝试使用我的本地代理打开任何链接时获得

HTTP请求:

GET http://uploaded.net/file/yueavjnq HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)
Host: uploaded.net
Accept: */*
Accept-Encoding: identity
Accept-Language: en-IN
Accept-Charset: *
Referer: http://uploaded.net/file/

HTTP响应:

HTTP/1.1 404 Not Found
Date: Thu, 12 Mar 2015 23:48:19 GMT
Server: Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15
Vary: accept-language,accept-charset
Accept-Ranges: bytes
Content-Type: text/html; charset=utf-8
Content-Language: en
Content-Length: 1195

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Object not found!</title>
<link rev="made" href="mailto:postmaster@localhost" />
<style type="text/css"><!--/*--><![CDATA[/*><!--*/ 
    body { color: #000000; background-color: #FFFFFF; }
    a:link { color: #0000CC; }
    p, address {margin-left: 3em;}
    span {font-size: smaller;}
/*]]>*/--></style>
</head>

<body>
<h1>Object not found!</h1>
<p>


    The requested URL was not found on this server.



    The link on the
    <a href="http://uploaded.net/file/">referring
    page</a> seems to be wrong or outdated. Please inform the author of
    <a href="http://uploaded.net/file/">that page</a>
    about the error.



</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:postmaster@localhost">webmaster</a>.

</p>

<h2>Error 404</h2>
<address>
  <a href="/">uploaded.net</a><br />
  <span>Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15</span>
</address>
</body>
</html>

另一个应用程序使用的相同请求得到了:

HTTP/1.1 302 Found
Date: Thu, 12 Mar 2015 23:51:00 GMT
Server: Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15
Location: http://localhost/directdl/?url=http://uploaded.net/file/yueavjnq
Content-Type: text/html; charset=iso-8859-1
Content-Length: 359

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://localhost/directdl/?url=http://uploaded.net/file/yueavjnq">here</a>.</p>
<hr>
<address>Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15 Server at uploaded.net Port 80</address>
</body></html>

我想达到什么目标。每当我在我的互联网下载管理器上放置任何链接时,它会将其重定向到“http://localhost/directdl/?url=”URl这种格式,它可以通过代理完成,它将根据需要重定向。它只能在IDM(Internet下载管理器)中使用,而IDM是我唯一希望使用它的应用程序。

0 个答案:

没有答案