Project

General

Profile

« Previous | Next » 

Revision 7998

web/main/index.php: $root: Fixed bug where need to use gethostbyaddr($_SERVER["SERVER_ADDR"]) instead of $_SERVER["SERVER_NAME"] because SERVER_NAME is actually set to whichever hostname the server is accessed through (e.g. path.vg or vegbiendev.nceas.ucsb.edu), rather than always being set to the reverse-DNS lookup of SERVER_ADDR, as is specified in the Apache docs ("If no ServerName is specified, then the server attempts to deduce the hostname by performing a reverse lookup on the IP address" <http://httpd.apache.org/docs/2.2/mod/core.html#servername&gt;)

View differences:

index.php
17 17
}
18 18

  
19 19
$h_level = 5;
20
$root = $_SERVER["HTTP_HOST"] === $_SERVER["SERVER_NAME"]
21
	? $alias : $_SERVER["HTTP_HOST"].$self_dir;
20
$root = $_SERVER["SERVER_NAME"] === gethostbyaddr($_SERVER["SERVER_ADDR"])
21
	? $alias : $_SERVER["SERVER_NAME"].$self_dir;
22 22
# instead of PATH_INFO, to support the Apache ErrorDocument directive
23 23
$rel_fs_path = rm_prefix($self_dir, $_SERVER["REQUEST_URI"]);
24 24
$path = parse_dot_path($rel_fs_path);

Also available in: Unified diff