Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3752049
D1168.id2984.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
849 B
Referenced Files
None
Subscribers
None
D1168.id2984.diff
View Options
diff --git a/includes/core.php b/includes/core.php
--- a/includes/core.php
+++ b/includes/core.php
@@ -255,15 +255,22 @@
* @return string the server URL
*/
function get_server_url () {
- switch ($port = $_SERVER['SERVER_PORT']) {
+ if (isset($_SERVER['HTTP_HOST'])) {
+ list ($name, $port) = explode(':', $_SERVER['HTTP_HOST'], 2);
+ } else {
+ $port = $_SERVER['SERVER_PORT'];
+ $name = $_SERVER['SERVER_NAME'];
+ }
+
+ switch ($port) {
case '80':
- return "http://$_SERVER[SERVER_NAME]";
+ return "http://$name";
case '443':
- return "https://$_SERVER[SERVER_NAME]";
+ return "https://$name";
default:
- return "http://$_SERVER[SERVER_NAME]:$_SERVER[SERVER_PORT]";
+ return "http://$name:$port";
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 14:44 (20 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2250775
Default Alt Text
D1168.id2984.diff (849 B)
Attached To
Mode
D1168: Prefer to read url from HTTP_HOST than SERVER_NAME
Attached
Detach File
Event Timeline
Log In to Comment