# Redirect with regex

**URL:** <https://discourse.pi-hole.net/t/redirect-with-regex/14902>\
**Category:** Help\
**Tags:** regex\
**Created:** [December 5, 2018, 10:12pm UTC](https://discourse.pi-hole.net/t/redirect-with-regex/14902 "2018-12-05T22:12:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jpgpi250](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jpgpi250/32/286_2.png) [@jpgpi250](https://discourse.pi-hole.net/u/jpgpi250)\
**Post date:** [December 6, 2018, 10:47am UTC](https://discourse.pi-hole.net/t/redirect-with-regex/14902/4 "2018-12-06T10:47:15Z")

</div>

I don't think you can redirect, using regex, however, A solution for individual redirects can be achieved. This has been explained [here](https://discourse.pi-hole.net/t/use-dns-to-force-youtube-into-restricted-mode-and-pi-hole/1996/22), for safe search.

for your redirect, this would imply this hosts (`/etc/hosts`) entry:

```auto
172.217.17.36	googlevideo.com 

```

or whatever googlevideo.com resolves to in your area

and a dnsmasq configuration file (`/etc/dnsmasq.d/97-redirect.conf`), containing the following:

```auto
cname=<the domain name you want to redirect>,googlevideo.com

```

you can enter as many redirections as you want to, just duplicate the `cname` entry and change `<the domain name you want to redirect>`

The down side of this approach is you will have to restart pihole-FTL every time you change the configuration file.

Don't know if this a solution for what you're trying to achieve...

---

_[View the full topic](https://discourse.pi-hole.net/t/redirect-with-regex/14902)._
