0

I am a de-facto IT Dude at a small company running on a LAN governed by a machine running Windows Server 08 R2. Our web sales and logistics director has asked me if I can create something internal to our company network where if you type in 'shipping' it goes to a Google Docs form that gets submitted back to him. Now, I understand how to 'name' a host, ascribing to an IP a string you can type into the address bar of a browser; I did it for our phone system and the printer at my boss' request. But how can I extend that to also resolve to the URLs of external web pages? Is that even possible?

1

You could use a CNAME to resolve one name to another, but that won't get you the full URL. DNS cannot resolve to complete URLs, just to host/domain names.

In order to do what you are being asked, you will need some type of application that performs an HTTP redirect. This is essentially how URL shorteners like bit.ly and goog.le work:

  1. User enters in shortener.com/shipping
  2. shortener.com web app looks up "shipping" in its database of shortened URLs
  3. shorterner.com redirects the user to the appropriate full URL

My company runs its own internal URL shortening service for exactly this purpose, using a short version of our corporate domain name.

3
  • Can you point me to any specific software, or was it developed in-house?
    – Nerdrage87
    Apr 17 '13 at 20:16
  • YOURLS is an open source one in PHP: yourls.org. Ours is in-house, and frankly it's a super easy little app to develop, just a little CRUD work and some HTTP redirects. Also if the stuff you are shortening is authenticated or if it's okay to do so, you can also just use a public URL shortener like goo.gl.
    – phoebus
    Apr 17 '13 at 20:22
  • Also if it's just for literally one thing, this "shipping" example, something like the answer from @ETL will work just fine. Using a URL shortener allows you to do it for arbitrary URLs in the future without much additional fuss.
    – phoebus
    Apr 17 '13 at 20:23
2

As others pointed out, a DNS record can't point to a URL. But what you can do (and what I do) is run an internal Apache server and create a virtual host on the Apache server for that name.

Say you create a DNS entry for "sales" and point that to the IP address where you run Apache.

Create a virtual host as in

<VirtualHost *:80>
  ServerName sales
  RewriteEngine on
  RewriteRule ^(.*)$ http://example.external.site.com/mysalesform [R,L]
</virtualHost>
1
  • +1 - Using a virtual host with a rewrite rule and a CNAME is an easy way to accomplish this without complex dependencies. You could get even simpler and use a virtual host that serves static HTML documents with meta http-equiv rewrites in the header. Apr 17 '13 at 20:41
1

You cannot make a record point to an URL.

What you can do is create a CNAME so that an internal name example.internal resolves to another name example.com.

The record will look like this:

example.internal. CNAME example.com.

You can then type http://example.internal/restofURI to access the external site. Note that this may cause trouble with SSL certificates due to the non matching hostname.

1
  • also, this will probably not work if the destination webserver is using name-based virtual hosts.
    – Renan
    Apr 17 '13 at 20:53
0

In the DHCP set up you can set up dns suffixes to append that will be pushed to all the clients on the network. You can also set this up manually on each box in the nic ipv4 properties. under the DHCP tab.

if you put "external.com" for example in there at the top it will try shipping.external.com first.

However, you cannot really mess with the path portion of the url that way. I'd recommend the first part and then use bookmarks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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