Redirect / to /admin

I'm trying to redirect the admin / directory to /admin to get rid of that annoying screen you see currently.

I found this on a 4 year old post

To redirect the root address to /admin, add the following line to /etc/lighttpd/lighttpd.conf:

url.redirect = ("^/$" => "/admin" )

But, it isn't that simple with docker. I created and cd'd into etc-lighttpd folder then did

docker cp pihole:/etc/lighttpd .

and got

external.conf
lighttpd
lighttpd.conf
lighttpd.conf.orig

Trying to remap lighttpd.conf didn't turn out so well

In volumes

./etc-lighttpd/lighttpd.conf:/etc/lighttpd/lighttp.conf
then
docker-compose up -d && docker-compose logs -f

Not good

pihole | mv: cannot move '/etc/lighttpd/lighttpd.conf' to '/etc/lighttpd/lighttpd.conf.orig': Device or resource busy
pihole | [cont-init.d] 20-start.sh: exited 1.

What if I map the whole directory to etc-lighttpd ?

pihole | grep: /etc/lighttpd/conf-enabled/15-fastcgi-php.conf: No such file or directory
pihole | sed: can't read /etc/lighttpd/conf-enabled/15-fastcgi-php.conf: No such file or directory
pihole | [cont-init.d] 20-start.sh: exited 2.

It looks like I'm digging myself in pretty deep. The image I'm using is "pihole/pihole:latest
"

Without having to fork pihole and build my own docker container, is there an easier way to redirect "/" to "/admin" ?

Edit: Reading through lighttpd.conf , I noticed the include statement for external.conf.
I edited the file with the / redirect line and then mapped the file

  • './etc-lighttpd/external.conf:/etc/lighttpd/external.conf'

So far so good. It redirects / to /admin and pihole is still blocking ads. WIN!

When browsing to pi.hole/ you should automatically be redirected to pi.hole/admin/. We don't do it for any other domain to prevent Pi-hole's dashboard showing up in places where ads have been blocked (this would happen with the IP blocking mode).

I'm not familiar with pi.hole . I typically use DNS name pattern "(service).home" or "(service).customdomain" for my self-hosted services, such as pihole.

So for pihole, I might use "pihole.home" in DNS.

For self hosted docker, service.home will typically go to a reverse proxy that redirect server.home:80 to the correct IP address and port, since the port is typically not port 80 or 443 to avoid port conflicts on the docker host.

eg 10 containers on the same host all want port 443, not going to happen unless perhaps like a customer http header routing works. I'm not sure how to set that up.

So this would need an exception from the (otherwise useful rule)

The current redirecting is a complex interplay between the blocking page (which is going to be obsoleted), a lighttpd config option and some PHP code in the AdminLTE package. In the future (the in-progress Pi-hole v6.0), things will become much easier to manage and I already added the requested feature here:

This makes Pi-hole v6.0 having an option WEBDOMAIN which can be set to any domain. If this domain is called, the redirecting to /admin will happen.

2 Likes

Is there a way I could achieve this right now, or will I have to wait for PI-Hole 6 (seems the release will be quite soon)?

Is there a time frame on PiHole v6? I'm also interested in moving my lighttpd.conf to a different mount location for the docker container so I can get block pages working with pixelserv-tls and am running into the same issue as this post outlines.