我正在 Joomla 上建立一个小型网站,遇到了一个奇怪的重定向问题。
我想在我的网站中包含一个指向在不同服务器上设置的论坛的链接。
当我在浏览器中输入或复制/粘贴论坛网址时,它可以完美运行:http://www.techcomputerworld.com/almeriarocketry/
这是请求/响应:
Request URL:http://www.techcomputerworld.com/almeriarocketry/
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Cookie:phpbb3_gu83i_u=1; phpbb3_gu83i_k=; phpbb3_gu83i_sid=5d7245ace142f186e3049d7666c528d7; __utma=214190226.1703438907.1378288831.1378288831.1378288831.1; __utmb=214190226.1.10.1378288831; __utmc=214190226; __utmz=214190226.1378288831.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); style_cookie=null
Host:www.techcomputerworld.com
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
Response Headersview source
Cache-Control:private, no-cache="set-cookie"
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:3805
Content-Type:text/html; charset=UTF-8
Date:Wed, 04 Sep 2013 10:05:56 GMT
Expires:0
Keep-Alive:timeout=10, max=29
Pragma:no-cache
Server:Apache
Vary:Accept-Encoding
于是我高兴地在我的网站上插入了指向该 URL 的链接。但当我点击它时,服务器抛出一个 302 重定向到另一个完全不同的位置:
Request URL:http://www.techcomputerworld.com/almeriarocketry/
Request Method:GET
Status Code:302 Found
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Cookie:__utma=214190226.1703438907.1378288831.1378288831.1378288831.1; __utmc=214190226; __utmz=214190226.1378288831.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); phpbb3_gu83i_u=1; phpbb3_gu83i_k=; phpbb3_gu83i_sid=a6f51f7f13a419b2ba46137a8cd6fc3b; style_cookie=null
Host:www.techcomputerworld.com
Referer:http://clubaereotabernas.net/index.php/el-club/instalaciones
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
Response Headersview source
Connection:Keep-Alive
Content-Length:313
Content-Type:text/html; charset=iso-8859-1
Date:Wed, 04 Sep 2013 17:56:33 GMT
Keep-Alive:timeout=10, max=30
Location:http://schiedsrichterge.bplaced.net/acwf.html?h=719406
Server:Apache
我能看到的唯一不同是 referrer 标头,但我尝试在 REST 客户端上模拟完全相同的值,而调用返回了 200。
我在 Safari、Firefox、Chrome 中遇到了这个问题。使用 IE8 时不会重定向。
我可以访问服务器并可以更改其中的任何内容,但不知道此配置位于何处。
任何帮助,不胜感激,谢谢。
答案1
您链接到的网站已被破解。它会将访问者重定向到传播恶意软件的页面(尽管该页面似乎已被删除)。
如果您认识该网站的所有者,您可能希望将此问题告知他们。
答案2
这是你的配置问题。有地方检查了 http referer 并进行了重定向。
无需 referer(将 URL 粘贴到浏览器中时)
$ curl -I 'http://www.techcomputerworld.com/almeriarocketry/'
HTTP/1.1 200 OK
Date: Tue, 10 Sep 2013 11:16:53 GMT
Server: Apache
Cache-Control: private, no-cache="set-cookie"
Expires: 0
Pragma: no-cache
Set-Cookie: phpbb3_gu83i_u=1; expires=Wed, 10-Sep-2014 11:16:53 GMT; path=/; domain=.www.techcomputerworld.com; HttpOnly
Set-Cookie: phpbb3_gu83i_k=; expires=Wed, 10-Sep-2014 11:16:53 GMT; path=/; domain=.www.techcomputerworld.com; HttpOnly
Set-Cookie: phpbb3_gu83i_sid=3a5a12af291853ba8299f5f5efc2d6ca; expires=Wed, 10-Sep-2014 11:16:53 GMT; path=/; domain=.www.techcomputerworld.com; HttpOnly
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8
带 referer 的请求(‘模拟’点击)
$ curl -I -H 'Referer: http://google.com/' 'http://www.techcomputerworld.com/almeriarocketry/'
HTTP/1.1 302 Found
Date: Tue, 10 Sep 2013 11:17:41 GMT
Server: Apache
Location: http://schiedsrichterge.bplaced.net/acwf.html?h=719406
Content-Type: text/html; charset=iso-8859-1
检查您的 apache 配置(尝试“grep -ri bplaced.net /etc/apache*”)+logs 和 Joomla。