Blacklist : is it possible to redirect to a specific address?



I am a beginner with pi hole.

When an address is blocked (blacklist) is it possible to redirect to a specific address?

I tried this solution (do not work):
Can I redirect a domain to a different domain? # 333
If you want to redirect traffic to to that is possible. There are a few things you need to do to get this working.

First you need to create 2 files using the touch command:
sudo touch /etc/dnsmasq.d/customRedirect.conf
sudo touch /etc/customRedirect.list
In /etc/dnsmasq.d/customRedirect.conf the following reference (using nano for example) to the other file:
addn-hosts = / etc / customRedirect.list
Next, you can put the actual redirect in /etc/customRedirect.list, in this example these 2 lines:
This would redirect to The actual markup is domain / ip address-redirect-from-domain redirect-to-domain
Please note, if the domain is already in the process of being blacklisted, it is going to be duplicated there, run <domain> so that it is ignored by pi-hole, and is instead picked up by customRedirect.list



Can you give an example of what you want to do? Normally a blacklist blocks a domain and returns NULL, NXDOMAIN, or whatever your blocking mode produces.

Do you want a request for a domain to be directed instead to an IP address other than the normal IP address of that domain?



Thank you for your reply

for example :
if or another site is in the black list: I want to redirect to a personalized error message.

example: this site is blocked on this LAN

in a perfect world I will wish to freely redirect the addresses. to to

with https I think this is probably impossible?

sorry for my little english because i’m french (we are better at making good stem of wine! english is not our best skill!)



You have this option if you use one of the other blocking modes available. Modes IP and IP-NODATA-AAAA both provide a built-in blocking page.

This section of the documentation discusses how to make this configuration change. It is a line item in a configuration file, very easy to set up.

Edit - Yes.

There is a related thread on forcing safe browsing that uses redirection methods - that may be of interest to you:

Finally, your English is fine and is much better than my French. :smile:


closed #7

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