# Redirect / to /admin

**URL:** <https://discourse.pi-hole.net/t/redirect-to-admin/44103>\
**Category:** docker\
**Created:** [February 7, 2021, 7:02pm UTC](https://discourse.pi-hole.net/t/redirect-to-admin/44103 "2021-02-07T19:02:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ikomrad](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/i/48db29/32.png) [@ikomrad](https://discourse.pi-hole.net/u/ikomrad)\
**Post date:** [February 7, 2021, 7:02pm UTC](https://discourse.pi-hole.net/t/redirect-to-admin/44103/1 "2021-02-07T19:02:58Z")

</div>

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](https://www.reddit.com/r/pihole/comments/4eirjz/is_it_possible_to_forward_a_domain_to_the_pihole/)

> To redirect the root address to /admin, add the following line to /etc/lighttpd/lighttpd.conf:
> 
> ```auto
> 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!

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [February 7, 2021, 7:23pm UTC](https://discourse.pi-hole.net/t/redirect-to-admin/44103/2 "2021-02-07T19:23:49Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![ikomrad](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/i/48db29/32.png) [@ikomrad](https://discourse.pi-hole.net/u/ikomrad)\
**Post date:** [February 7, 2021, 7:36pm UTC](https://discourse.pi-hole.net/t/redirect-to-admin/44103/3 "2021-02-07T19:36:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Coro](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/coro/32/15424_2.png) [@Coro](https://discourse.pi-hole.net/u/Coro)\
**Post date:** [February 8, 2021, 8:29am UTC](https://discourse.pi-hole.net/t/redirect-to-admin/44103/4 "2021-02-08T08:29:41Z")

</div>

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

> [@DL6ER](#):
>
> 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).

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [February 13, 2021, 6:01pm UTC](https://discourse.pi-hole.net/t/redirect-to-admin/44103/5 "2021-02-13T18:01:32Z")

</div>

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:

> <https://github.com/pi-hole/FTL/commit/01bb3bce23fa6009c1a7fd5130546f7ff14fed02>
>
> Signed-off-by: DL6ER \<dl6er@dl6er.de\>

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.

---

<div class="post-metadata">

**Author:** ![fischer-felix](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/fischer-felix/32/31349_2.png) [@fischer-felix](https://discourse.pi-hole.net/u/fischer-felix)\
**Post date:** [June 12, 2022, 11:22am UTC](https://discourse.pi-hole.net/t/redirect-to-admin/44103/6 "2022-06-12T11:22:27Z")

</div>

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)?

---

<div class="post-metadata">

**Author:** ![Maximilious](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/maximilious/32/29535_2.png) [@Maximilious](https://discourse.pi-hole.net/u/Maximilious)\
**Post date:** [June 22, 2022, 2:21am UTC](https://discourse.pi-hole.net/t/redirect-to-admin/44103/7 "2022-06-22T02:21:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TOTALINFRA](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/totalinfra/32/34044_2.png) [@TOTALINFRA](https://discourse.pi-hole.net/u/TOTALINFRA)\
**Post date:** [December 21, 2022, 10:15pm UTC](https://discourse.pi-hole.net/t/redirect-to-admin/44103/8 "2022-12-21T22:15:44Z")

</div>

I use Pihole on Docker, and I did the customization through a docker-compose.  
To solve this problem, just add an environment variable:

The EV name is: VIRTUAL\_HOST

Example:  
- VIRTUAL\_HOST=pihole.mydomain.com

Now, when I login via this domain name (pihole.mydomain.com), /admin is automatically redirected.

---

<div class="post-metadata">

**Author:** ![\_Andrew](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/_andrew/32/37193_2.png) [@\_Andrew](https://discourse.pi-hole.net/u/_Andrew)\
**Post date:** [May 29, 2023, 9:00pm UTC](https://discourse.pi-hole.net/t/redirect-to-admin/44103/9 "2023-05-29T21:00:33Z")

</div>

To elaborate, the official Docker image implements the redirection method explained in the [Core 5.15 release announcement](https://pi-hole.net/blog/2023/01/15/pi-hole-ftl-v5-20-1-web-v5-18-1-and-core-v5-15-released/) by [generating](https://github.com/pi-hole/docker-pi-hole/blob/37bd3d2f0f9321211d9370fc96b7d06325cee887/src/s6/debian-root/usr/local/bin/bash_functions.sh#L381-L391) a `15-pihole-custom-admin-redirect.conf` based on `VIRTUAL_HOST`.
