So your are working on a website on your local dev machine and maybe you want to run the website in Local IIS with a custom url. You don't want to run it as an application under the default website, you want it to be a website on it's own with a custom url. So you need to get that custom url to point to your localhost, basically

Old Way

Here is how you would normally do it by adding the url to the host file:

  1. Open Notepad as an administrator by right-clicking on it in the start menu and choosing 'Run as administrator'
    Click File > Open > C:\Windows\System32\drivers\etc

  2. Above the open button where it says TextDocuments (*.txt) change it to All Files (*.*)

  3. Then select the file named hosts and click on Open.

  4. Add a new line at the bottom of the file like this: codeshare.local

  5. The number on the left is the IP address where you want that url to point to. Leave it as so it points to your machine. the address on the right is the address of your site. Notice that it doesn't need http:// in front of if here.

  6. Save the file.

New Way

Here is how you can do it now.

  1. Just think of a url which ends with like this:

How does it work?

Some kind person has set up the domain and set the DNS for * to point to, so basically it just points to your local machine.

Go ahead and try it.

To test it out, you could use the command line to do the following:


You will see it replies from So there is no need to edit your hosts file any more for local development urls.

I was really pleased when I found this out from one of my YouTube subscribers, so I thought I should share it with you.

Please share this with others to let them know about it.


Thanks to brunty and cemerson from the Tech Nottingham Slack Group for pointing out some security concerns with this. They were concerned that the domain owner could point the traffic to a malware site or something like that, which is a valid point, but I trust the person who registered the domain.

If you don't trust the person who set this domain up, you could always register a domain for yourself and point the subdomains to to achieve the same thing.

Paul Seal

Umbraco MVP and .NET Web Developer from Derby (UK) who specialises in building Content Management System (CMS) websites using MVC with Umbraco as a framework. Paul is passionate about web development and programming as a whole. Apart from when he's with his wife and son, if he's not writing code, he's thinking about it or listening to a podcast about it.

Proudly sponsored by


  • Moriyama build, support and deploy Umbraco, Azure and ASP.NET websites and applications.

  • CI/CD service for Windows, Linux and macOS
  • Build, test, deploy your apps faster, on any platform.

  • Custom stickers for startups, artists and brands.
  • Bespoke easy-apply, removable, custom brand stickers printed in the UK.

  • is the easy error logging and uptime monitoring service for .NET.
  • Take back control of your errors with support for all .NET web and logging frameworks.
uSync Complete

  • uSync.Complete gives you all the uSync packages, allowing you to completely control how your Umbraco settings, content and media is stored, transferred and managed across all your Umbraco Installations.

  • More than a theme for Umbraco CMS, take full control of your content and design with a feature-rich, award-nominated & content editor focused website platform.

  • Affordable, Geo-Redundant, Umbraco hosting which gives back to the community by sponsoring an Umbraco Open Source Developer with each hosting package sold.