1

I am unsure if this is possible. I am trying to use the Window's hosts file to redirect the address www.youtube.com to music.youtube.com.

When I ping youtube.com, I am returned with this IP:

  • 172.217.12.14

When I ping music.youtube.com I get this IP:

  • 172.217.1.206

In the hosts file, I type the following:

172.217.1.206 www.youtube.com
172.217.1.206 music.youtube.com

I would like to re-direct the exact route of www.youtube.com to music.youtube.com who's IP is 172.217.1.206

So far this lets the YouTube website load normally with the www.youtube.com URL. I would like it to re-direct me to music.youtube.com WITHOUT blocking or restricting video-specific YouTube URLs. How do I make the hosts file or something to work this way?

(I don't care if I can access a YouTube video's URL manually, I just want to re-route the main domain name: www.youtube.com.)

EDIT: For more clarification, I would like to type this address: www.youtube.com in the browser and be re-directed to music.youtube.com. If I type: https://www.youtube.com/watch?v=dQw4w9WgXcQ it will load Youtube normally without the re-direct. I would like the re-direct to only happen with the URL www.youtube.com.

RATIU5
  • 175
  • 1
  • 8

1 Answers1

2

No, unfortunately, this is not possible using the host file. That is not how DNS resolution works. To put it in simple terms, if you redirect the domain www.youtube.com to a certain IP address via the host file it will redirect all traffic. Regardless of what comes after the www.youtube.com/.

There are plenty of other solutions though, for example installing a web server and using htaccess for the redirect (see this question on StackExchange or this one).

A redirection service in combination with the host file might work as well, see here.

The last option I can think of is using 3rd party software, for example installing your own local DNS server, like SANS or one of many others. It might be worth checking your internet router's options as well.

Albin
  • 9,307
  • 11
  • 50
  • 89