1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-17 21:59:55 +00:00

Redirect to admin panel when accessing 'http://pi.hole/'

If someone tries to access 'http://pi.hole/', it will take them to the "Website blocked" page. Very confusing if you don't know to go to 'http://pi.hole/admin/'. This just redirects them to the admin panel.
This commit is contained in:
raincoats 2017-03-05 16:58:21 +11:00
parent 05640f9a6b
commit eb763d2dc2

View File

@ -4,6 +4,14 @@
$uri = escapeshellcmd($_SERVER['REQUEST_URI']); $uri = escapeshellcmd($_SERVER['REQUEST_URI']);
$serverName = escapeshellcmd($_SERVER['SERVER_NAME']); $serverName = escapeshellcmd($_SERVER['SERVER_NAME']);
// If the server name is 'pi.hole', it's likely a user trying to get to the admin panel.
// Let's be nice and redirect them.
if ($serverName === 'pi.hole')
{
header('HTTP/1.1 302 Found');
header("Location: /admin/");
}
// Retrieve server URI extension (EG: jpg, exe, php) // Retrieve server URI extension (EG: jpg, exe, php)
$uriExt = pathinfo($uri, PATHINFO_EXTENSION); $uriExt = pathinfo($uri, PATHINFO_EXTENSION);