Skip to content

Commit 1895955

Browse files
committed
Include the port number, if it's not 80.
In my local dev environment, I'm using port 8080, and this was causing problems with the rendering of pages, so I added these lines to ensure that the server port is always included, if it's not port 80. This will aid in development.
1 parent 2e71bad commit 1895955

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
$requestedPage = '404';
3232
}
3333

34-
$baseHref = '//' . $_SERVER['SERVER_NAME'] . $base . (substr($base, -1) == '/' ? '' : '/');
34+
$serverName = $_SERVER['SERVER_NAME'];
35+
$serverName .= ($_SERVER['SERVER_PORT'] != 80) ? ':' . $_SERVER['SERVER_PORT'] : '';
36+
$baseHref = '//' . $serverName . $base . (substr($base, -1) == '/' ? '' : '/');
3537

3638
if (!(include 'resources/' . $requestedPage . '.html')) {
3739
header('HTTP/1.0 404 Not Found');

0 commit comments

Comments
 (0)