Here are the refined instructions for my particular block page setup...
How to set up a custom block page in Pi-Hole:
-
Create a folder in your documents folder called "CustomBlockPage".
-
Copy the following files from the Pi-Hole web site into the folder:
https://pi-hole.net/wp-content/uploads/2016/12/Vortex-R.png (Logo)
https://piholenet.b-cdn.net/wp-content/uploads/2017/03/pihole-llc.png (Background)
-
Open a terminal window with LXTerminal.
-
Copy the image files to the Pi-Hole block page folder:
sudo cp /home/[Your user name]/Documents/CustomBlockPage/*.* /var/www/html/pihole
- Create an HTML file for your custom block page with the name "CustomBlockPage.htm" and paste the HTML code in the file:
(NOTE: Do not use LeafPad to make the file because it does not correctly format text for our purposes.)
sudo nano /var/www/html/pihole/CustomBlockPage.htm
<HTML>
<TITLE>BLOCKED</TITLE>
<BODY BGCOLOR=000000 BACKGROUND="pihole/pihole-llc.png" TEXT=FFFFFF>
<CENTER>
<BR>
<IMG SRC="pihole/Vortex-R.png" WIDTH=100><BR>
<FONT Size=+2>
<BR>
This Page has Been Blocked<BR>
*OR* Does not exist<BR>
</FONT>
<BR>
Notice: Some pages have been blocked due to content or bandwidth restrictions.
<BR>
<BR>
If you believe that this page has been blocked in error,<BR>please contact the front desk.
</CENTER>
</BODY>
</HTML>
Save and close.
- Set your file's permissions:
sudo chmod +x /var/www/html/pihole/CustomBlockPage.htm
- Open the "lighttpd.conf" file to change the error handler for 404 file not found errors so that the custom block page opens instead of the default:
sudo nano /etc/lighttpd/lighttpd.conf
- Comment out the line "server.error-handler-404="pihole/index.php"" with "#", then add a new line with the custom block page file:
#server.error-handler-404="pihole/index.php"
server.error-handler-404="pihole/CustomBlockPage.htm"
Save and exit.
- Restart the lighttpd service:
sudo service lighttpd restart
- Change the blocking mode to "IP-NODATA-AAAA" in the "pihole-FTL.conf" file by adding a block mode line:
sudo nano /etc/pihole/pihole-FTL.conf
add this line:
BLOCKINGMODE=IP-NODATA-AAAA
Save and exit.
(Note: "IP-NODATA-AAAA" returns the IP address of the Pi-Hole as the page location. When Pi-Hole tries to load the page, it returns a 404 error and re-directs to the custom block page. Null returns an IP of 0.0.0.0 which will not help directing to the block page. "IP" and the other options also do not return a useful IP address for our purposes.)
- Restart the pihole-FTL service:
`sudo service pihole-FTL restart`
Congratulations, your block page is now ready.
Please Note: You may have to flush the DNS caches and browser cashes on the computers in your network for all the changes to take effect.