Please follow the below template, it will help us to help you!
If you are Experiencing issues with a Pi-hole install that has non-standard elements (e.g you are using nginx instead of lighttpd, or there is some other aspect of your install that is customised) - please use the Community Help category.
Expected Behaviour:
I am running Pi-Hole on a Raspberry PI 4B Raspbian Linux system. I ave a textfile containing the list of the URL's I want to be blocked by Pi-Hole when I try to access them from my browser. My question is How can I "declare" or "insert" this textfile into Pi-Hole blacklist mechanism ?
I know how to declare ONE new URL to be blacklisted, using the graphic interface of Pi-Hole, but this interface cannot be used if one have to declare a lrage quantity of URL's. In the documentation on Internet they speak about creating a /etc/pihole/ blacklist.txt file containting the list of URL's to block but what else has to be done so as it work ?
Thnak you by advance for any help.
Regards
Just to make this clear, Pi-hole does not block URLs but domains. May just be a wording issue.
This is not correct. You can add many domains at once if you have them space separated. Straight copying from a file where they are in multiple lines works as well.
This is outdated, they are now stored in a database /ets/pihole/gravity.db which you can edit with any tool you prefer. The database supports mass additions as well.
In addition, you can put the file anywhere on your Pi-hole and add an adlist with a URL like
file:///home/pi/mylist.txt
Every pihole -g will "download" your list and use it. This has the benefit that you can manage everything in it per-group very easily.
Hi Coro,
I thank you very much for your answer. There is something I do not understand when you say: you can put the file (text file containing a list of domains, one on each line ?) anywhere on your Pi-Hole and every "pihole -g" command will download this list and use it.
How is it possible: I don't understant how this "pihole -g" command can know the name of my text file and where it is located ? Or is this command always expecting this list of domain names to be in the same file: /home/pi/mylist.txt ?
Thank you by advance for further explanations.
Regards
You would enter the file path of your local list of domains to be blocked (your existing text file) as an adlist in Group Management > Adlists.
When Pi-hole rebuilds gravity, it will load this file from the specified file path the same as it loads any other adlist that is reached via a URL.
Instead of ending up in the blacklists, your text file will be imported into the gravity list. The net effect will be the same, but Pi-hole will automatically pick up any changes to your text file, without you having to manually enter the changes into the blacklist. If you add or remove an entry from your text file, the next time gravity updates the changes will be incorporated into Pi-hole.