# Block everything, allow whitelisted only!

**URL:** <https://discourse.pi-hole.net/t/block-everything-allow-whitelisted-only/15782>\
**Category:** Help\
**Created:** [January 4, 2019, 2:48am UTC](https://discourse.pi-hole.net/t/block-everything-allow-whitelisted-only/15782 "2019-01-04T02:48:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sudhaker](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/sudhaker/32/6025_2.png) [@sudhaker](https://discourse.pi-hole.net/u/sudhaker)\
**Post date:** [January 4, 2019, 2:48am UTC](https://discourse.pi-hole.net/t/block-everything-allow-whitelisted-only/15782/1 "2019-01-04T02:48:08Z")

</div>

Is there a way to block everything and allow whitelisted domains only?

PS: I can achieve it by supplying a null-DNS to pihole & adding followings to 01-pihole.conf ( but not through UI )

To allow google & twitter but block everything else.

```
server=/google.com/good-DNS
server=/twitter.com/good-DNS

```

Regards,

---

<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:** [January 4, 2019, 9:13pm UTC](https://discourse.pi-hole.net/t/block-everything-allow-whitelisted-only/15782/2 "2019-01-04T21:13:17Z")

</div>

Another method - which is supported through the web interface - is adding a regex filter that will match anything, maybe as simple as

```auto
*

```

and then selectively whitelist the domains you want, also though the UI.

---

<div class="post-metadata">

**Author:** ![sudhaker](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/sudhaker/32/6025_2.png) [@sudhaker](https://discourse.pi-hole.net/u/sudhaker)\
**Post date:** [January 5, 2019, 4:47pm UTC](https://discourse.pi-hole.net/t/block-everything-allow-whitelisted-only/15782/3 "2019-01-05T16:47:52Z")

</div>

Cool - the regex should be ".\*" to block-all; but how to whitelist \*.google.com & \*.twitter.com

Don't want to manage all deeper level of domains in whitelist like api.twitter.com

---

<div class="post-metadata">

**Author:** ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)\
**Post date:** [January 5, 2019, 4:53pm UTC](https://discourse.pi-hole.net/t/block-everything-allow-whitelisted-only/15782/4 "2019-01-05T16:53:14Z")

</div>

> [@sudhaker](#):
>
> how to whitelist \*.google.com & \*.twitter.com

In Pi-Hole (current version pre-V5) you cannot whitelist wildcards. Only exact domains can be whitelisted.

The reason for this is that whitelisting a domain makes it "gravity proof". When gravity is updated, a list of domains is created from your subscribed blocklists. These are sorted, duplicates removed, and then all the domains in your whitelist are removed from gravity.

Since gravity is a list of single domains, the whitelist is the same.

---

<div class="post-metadata">

**Author:** ![system](https://discourse.pi-hole.net/uploads/default/original/3X/7/c/7c8792f649eeb921c5d2b4c41564ffa873d9a2b8.png) [@system](https://discourse.pi-hole.net/u/system)\
**Post date:** [January 29, 2019, 5:31am UTC](https://discourse.pi-hole.net/t/block-everything-allow-whitelisted-only/15782/8 "2019-01-29T05:31:16Z")

</div>

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
