We help IT Professionals succeed at work.

How to resolve website adress with same name as doamin in AD 2012 R2 AD

netcomp asked
We have setup a domain name with same as outside hosted wbesite. so, internal domain is example.com  and our website url is www.example.com and is hosted on a third party hosting . I know the IP of the site. I tried creating a www pointing to the website and it did not work. Also, it would be nice for the website to still resolve if they don't put the www in front of the url. This is because I know that some users will simple forget to do www.example.com . Thank you
Watch Question

Top Expert 2016
they have to use www OR with a single DC add the iis role and on the default site use a url redirect
GUI Method
Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI based on your IIS administrative role, see Navigation in IIS Manager (IIS 7).
In Features View, double-click HTTP Redirect. On the HTTP Redirect page, select Redirect requests to this destination. In the corresponding box, type the file name, directory path, or URL to which you want to redirect the user.  In the Actions pane, click Apply.

cmd line
appcmd set config /section:httpRedirect /enabled:true /destination:www.example.com
Distinguished Expert 2018
"I know the IP of the site. I tried creating a www pointing to the website and it did not work."

When done properly, that should work. Use nslookup to verify the record and browser developer tools to view the network traffic to troubleshoot.

"Also, it would be nice for the website to still resolve if they don't put the www in front of the url."

This gets ugly when the domain name is the same as the AD name. Because AD needs to resolve the root name internally, you can't simply create an @ record. Things break. My usual response is "they have to remember the www." That's just a user training issue and is the secure option.

Some articles and blogs may suggest setting IIS up on all domain controllers and configuring it to respond and issue an HTTP redirect to the www URL. I honestly do not consider this approach wise in the modern security landscape and IIS's inherent architecture and service account access. This significantly widens the attack footprint of the OS. On a member server, that can be mitigated (which is why web servers often live on an isolated network segment...DMZ) but on a DC? No thanks. If telling users that they have to remember the www is truly not an option, then it's time to consider migrating AD to a best-practice name that is unique. Like office.domain.com or ad.domain.com, instead of just domain.com. AD migrations in small environments are initially daunting, but aren't as difficult as they first appear.
DrDave242Principal Support Engineer
If creating the www record on your internal DNS server didn't work, it's likely that the website is configured to redirect www.example.com to example.com. You can test this by accessing www.example.com from outside your network. If the URL in the browser address bar changes from www.example.com to example.com when the page opens, there's a redirect in place, and you'll need to get rid of it. The web host and/or site developer should be able to do that.

Users will still need to remember the www, though. There's no way around that unless you want to change the name of your internal domain, as Cliff explained above.