PiHole Custom Block Page
Website Visitors:Follow the below steps to create a custom block page for blocked sites in pihole for HTTP sites:
-
In terminal, run
sudo nano /etc/pihole/pihole-FTL.conf
-
If you do not have this file, create a file with the same name in the same path. If it is already there, you will see PRIVACYLEVEL=0 in the file already. Add BLOCKINGMODE=IP-NODATA-AAAA to it, save and close.
-
Restart the PiHole-FTL service:
sudo service pihole-FTL restart
-
Next, edit lighttpd.conf file:
sudo nano /etc/lighttpd/lighttpd.conf
-
Search for the value
server.error-handler-404 value.
If it is commented, uncomment it by removing the # at the beginning of the line. It should be like:server.error-handler-404 = "pihole/index.php".
Change it to"/pihole/custom.html".
Make sure you add the forward slash (/) before pihole. If you do not enter it, block page doesn’t work. Hit ctrl X, and Y to save the changes on nano editor. -
Restart lighttpd service:
sudo service lighttpd restart
-
Copy the background png image and any other custom images to /var/www/html/pihole folder on the pihole machine. My block page looks like shown below:
-
Create the custom.html file:
sudo nano /var/www/html/pihole/custom.html
1 2 3 4 5 6 7 8 9 10 11
<HTML> <TITLE> page BLOCKED</TITLE> <BODY BGCOLOR=000000 TEXT=FFFFFF> <CENTER> <BR><BR><BR><BR><BR> <IMG CLASS = “LEFT” SRC=”pihole/piholeCustomImage.png” WIDTH=400><BR><BR><BR> <h1 style=”font-size:40px;”>WHERE DO YOU THINK YOU ARE GOING?</h1> <p style=”font-size:30px;”>This Page has Been Blocked By PiHole.</p> </CENTER> </BODY> </HTML>
-
Save and close the html file.
-
Next change the permissions of this html file:
sudo chmod +x /var/www/html/pihole/custom.html
-
Restart lighttpd service:
sudo service lighttpd restart
-
Finally run
pihole restartdns
When you make any changes to the html file restart lighttpd service as shown above. With all the above steps, all the urls which are blocked in your network via HTTP will show the custom block page. This will not work for HTTPS sites.
Want to learn more on Citrix Automations and solutions???
Subscribe to get our latest content by email.