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

Hello

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 www.exampledomain1.com to www.differentdomain.com 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:
www.exampledomain1.com www.differentdomain.com
exampledomain1.com differentdomain.com
This would redirect exampledomain1.com to differentdomain.com. 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 whitelist.sh <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?

@jfb
Thank you for your reply

for example :
if facebook.com 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.

www.facebook.com to xxxxx.com
www.google.com to yyyyy.com

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.

https://docs.pi-hole.net/ftldns/blockingmode/

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:

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