-3

I want to redirect a URL to another URL when accessed through my network.

For example, www.youtube.com to www.mywebsite.com(hosted on my local server). I also and always want to give the option of continuing to www.youtube.com after www.mywebsite.com has been visited and the user must press a button to continue to the originally requested website. This should happen every time the original website is requested by the browser. The user should only be able to access the original website if he has pressed the continue button on www.mywebsite.com, I dont want a loop so if the button has been pressed then no redirects, but if the user closes and opens the tab/browser he must go through this process.

PS: Can a ISP do this?(doesn't have to redirect to my locally hosted website... any government website)

  • What is "your network"? If it's one PC, then use hosts file. If it's a Windows domain with a small number of users who are all informed of it, then use Windows DNS. Use other DNS for other OSes. If the other users are not informed, then you really need to ask yourself why you need to perform a man-in-the-middle. – Christopher Hostage Apr 20 '18 at 15:32
  • @ChristopherHostage Its one PC, but what do you mean by users informed? – Hamza Umair Apr 20 '18 at 15:35
  • You need to use a proxy server in order to do this. There's no other way as far as I know. – LPChip Apr 20 '18 at 18:50
  • @hazma , it's important to let other people know if you're redirecting their traffic. So if this is your home and only your PCs and devices are affected, then no one else to inform. However, if you're in a business, school, or public location, it's important to inform people when you're redirecting traffic. – Christopher Hostage Apr 20 '18 at 19:51
-2

Can't comment yet but, there are multiple ways to do this. It would help if you described how your network is setup. Some ad websites use url redirection techniques (see: https://stackoverflow.com/questions/768431/how-to-make-a-redirect-in-php for an e.g ). On an internal network you could also use a proxy server (see: https://stackoverflow.com/questions/18706276/apache-adding-a-url-redirect-via-proxy-server?rq=1 )

Afaik an ISP will not do it (or they may if they have to for some reason not related to a customer).

  • ISP's may do this too. For example you first get their ISP page where you need to provide credentials before you can sign the web. I used to have a cheap ISP that only allowed me access at certain times, and they showed banners to keep costs low. – LPChip Apr 20 '18 at 18:51

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.