Skip to content

Instantly share code, notes, and snippets.

@jeff47
Created September 7, 2025 00:33
Show Gist options
  • Select an option

  • Save jeff47/5167bfce39be6bc2ba0a9b089310485a to your computer and use it in GitHub Desktop.

Select an option

Save jeff47/5167bfce39be6bc2ba0a9b089310485a to your computer and use it in GitHub Desktop.
Wildcard domains in pihole

It can be useful to create wildcard domains for local services.  Rather than create one for each local service, a wildcard is easier. It would be easy to use dnsmasq to do this, but Pihole no longer directly supports that.

There are two options to get this to work:

misc.dnsmasq_lines

The developers of Pihole anticipated that we might have this very need. In the GUI, switch to Expert mode and then go to All Settings->Miscellaneous. Scroll down to misc.dnsmasq_lines where you can add individual values that will be injected into the configuration.

Add address=/.local.mydomain.com/192.168.1.16 for a wildcard. (The leading . is vital!)

Regex domain redirects

You can create wildcard domain directs using a regex rule in Pihole like this:
(^|\\.)local\\.mydomain\\.com\$;reply=192.168.1.16

Set the rule to "Regex Deny" to have the rewrite work.

@viscount-monty
Copy link

Thanks! Just what I was looking for 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment