summaryrefslogtreecommitdiff
path: root/httpexists-proxy.php
blob: adc4df42deba0533e075b669605e6d9705dd5c26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php 
// Rough proxy to help map.js check for photos.
// Reason being that requests similar to http://www.tcd.ie/Maps/photos/small/100.jpg
// were being redirected to http://www.tcd.ie/Maps/photos/small/200.jpg or similar.
// Because the web server is set up to permenantly redirect 301 to files with a similar name.
// JavaScript cannot check for redirects (30x) as they are completed before the JavaScript runs.
// Hence maps.js always got a 200 OK response for redirected photos.
if (!empty($_GET['httpexistsurl'])) {
	if (file_exists(dirname($_SERVER['SCRIPT_FILENAME']).'/'.$_GET['httpexistsurl'])) {
		// all good
	}
	else {
		header("HTTP/1.0 404 Not Found");
	}
}
else {
	header("HTTP/1.0 404 Not Found");
}

?>