Website redirection is something that websites do when they’ve migrated from one domain to another. It makes it easier for users who still visit the old domain to automatically be redirected to the new one. Of course, URL redirection isn’t just for websites. If you often accidentally visit the wrong domain, you can add a redirection at the OS level. To redirect a URL on Windows 10, you have to edit the hosts file. Here’s what you have to do.

Redirect a URL

The first thing you need to do is decide which URL or which domain you want to redirect to another. Let’s say you intend to visit Google but you accidentally keep visiting Reddit (it happens). This means you need to make it so that Reddit is redirected to Google.

To do that, you must first find the public IP of Google. Open Command Prompt and run the following command.

Syntax

ping domain-name

Example

ping www.google.com

The first line of output will show you the IP of the website in square brackets. Copy it.

Open the Start Menu and go to the apps’ list. Look for Notepad. Alternatively, use Windows Search to find it. Right-click the app and select ‘Run as administrator’ from the context menu.

Once Notepad is open, use the File>Open option on the menu bar and navigate to the following location.

C:\Windows\System32\drivers\etc

Open the file type dropdown and change it from text files to all files. Select the hosts file.

Once the hosts file is open, enter the following on a line of its own. Do not add a hash before it

Syntax

[Redirected IP address] [domain to redirect]

Example

216.58.207.4 www.reddit.com

The IP address is where the domain that follows it will be redirected to. The above example will redirect Reddit to Google.

Use the Ctrl+S keyboard shortcut to save the changes. Next, open Command Prompt with admin rights and run the following command.

ipconfig /flushdns

For good measure, close and re-open any browser you have open. Visit the website and it will be redirected to the IP address you entered. You can do this for as many websites as you want.

You can redirect as many URLs or domains you like and you can redirect them all to different URLs or to the same one. It is entirely up to you. To undo this change, remove the lines you add, flush the DNS again, and restart all browsers.

Sometimes even flushing the DNS doesn’t do the job. In that case, it’s a good idea to restart your system.

Read How to redirect a URL on Windows 10 by Fatima Wahab on AddictiveTips - Tech tips to make you smarter



from AddictiveTips https://ift.tt/2GLLcRN
via IFTTT