While this doesn't relate directly to pi-hole (I'm not trying to block YouTube ads), I figured this community may be able to offer insight on layering uses of dnsmasq on top of a pihole device.
I've found here: https://support.google.com/youtube/answer/6214622?hl=en, that youtube offers an alternate URL that can be used as a cname for their primary domains that will force youtube into restricted/semi restricted modes.
Essentially, it's this:
Configure Domain Name System (DNS) on your network to add a Canonical Name (CNAME) for the following hostnames:
www.youtube.com m.youtube.com youtubei.googleapis.com youtube.googleapis.com www.youtube-nocookie.com
For Strict Restricted YouTube access, add restrict.youtube.com as a CNAME for these domains. For Moderate Restricted YouTube access, add restrictmoderate.youtube.com as a CNAME for these domains.
I've been trying to figure out how to/if I can leverage my pihole machine to achieve this, or if I'll have to get another device/server to do it.
I've tried adding cnames to the dnsmasq.conf file, and adding records to a hosts file, but I always get dnsmasq errors and it won't restart, or it restarts and doesn't perform the redirect via the cname - so I'm sure I'm doing something wrong.
This seems close to what I'm trying to do, but even these steps don't yelid any fruit.
Wondering if anyone with more dnsmasq/pihole experience can lend any advice.
If it makes a difference, I'm running pihole on Ubuntu 16.04 server.
Edit: @jpgpi250 solved this problem in post #4 - changed the answer to post 15 where @jpgpi250 graciously spells out the steps to achieve all of this step by step