Contents

PiHole Custom Block Page

Website Visitors:
Contents

Follow the below steps to create a custom block page for blocked sites in pihole for HTTP sites:

  1. In terminal, run sudo nano /etc/pihole/pihole-FTL.conf

  2. 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.

    https://www.mediafire.com/convkey/1068/4g2ivyp16hcqqtsbg.jpg
    Pihole-FTL
  3. Restart the PiHole-FTL service: sudo service pihole-FTL restart

  4. Next, edit lighttpd.conf file: sudo nano /etc/lighttpd/lighttpd.conf

  5. 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.

    https://www.mediafire.com/convkey/a8c2/91lukhb14vja77ubg.jpg
    Pihole Error Handler
  6. Restart lighttpd service: sudo service lighttpd restart

  7. 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:

    https://www.mediafire.com/convkey/a807/bvas5jrpx3caccb5g.jpg
    Page blocked by pihole
  8. 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>
    
  9. Save and close the html file.

  10. Next change the permissions of this html file:  sudo chmod +x /var/www/html/pihole/custom.html

  11. Restart lighttpd service: sudo service lighttpd restart

  12. 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.

Source1

Source2

Want to learn more on Citrix Automations and solutions???

Subscribe to get our latest content by email.

If you like our content, please support us by sponsoring on GitHub below: