Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm not sure if I worded the question correctly to be honest but basically what I want to do is:

When a user types in something like Expenses in the URL bar of a browser, I want the browser to be directed to a specific web address (very very similar to how OpenDNS shortcuts work)

The IP address of the web address will not change amongst the different 'shortcuts'... i.e:

mycompany.com = 10.0.0.0

mycompany.com/expenses = 10.0.0.0

mycompany.com/tracker = 10.0.0.0

When a user types expenses in the browser address bar and presses enter, I want the browser to automatically direct to the specified address as above.

Would this be tricky to implement? I hope I have put my question forward appropriately :-)

Additional notes:

  • We are on a Windows envionment

  • I believe the exchange server is running as the DNS server in the office

share|improve this question

6 Answers 6

up vote 8 down vote accepted

How about creating a DNS entry for "expenses.mycompany.com" that sends to a webserver with a redirect rule of expenses.mycompany.com -> mycompany.com/expenses?

As long as clients have a DNS suffix of "mycompany.com" set they will convert "expenses" into expenses.mycompany.com, and hit that webserver.

It means a few extra DNS entries, and some virtual hosts on the webserver that do nothing but redirect to the "real" URLs?

share|improve this answer

While not exactly what you're after, why not use a URL shortener on your internal servers? Then you can setup a virtual host on your server that hosts the URL shortener, and do something like:

http://go/expenses
http://go/tracker

The URL shortener would rewrite that to your necessary internal URL. There is an example of a .NET URL Shortener here.

The other alternative is as mfarver says, you'll need to setup a DNS record pointing to a host that reads the host header requests, and redirects appropriately. This would need to be done via a URL Rewrite rule in IIS (or apache if you want to run it on windows), or some code to do all the work for you. They both do essentially the same thing as the URL shortener.

share|improve this answer
    
I don't understand the downvote on this. While not what the OP asked for, it would still solve their problem... –  Ben Pilbrow Jan 15 '11 at 17:03
4  
This site is about solving problems, and that sometimes involves a compromise somewhere along the line. I wouldn't say this was an unreasonable compromise for the OP. –  Ben Pilbrow Jan 15 '11 at 17:05

Define your DNS Search domain for the clients as e.g. company.com

Create cnames for expenses, etc. that point to the web server

Publish each 'target' url as its own site on the web server (e.g. webserver.company.com/expenses becomes expenses.company.com)and use host headers to direct browsers as they hit the web server (you might need to fiddle with host headers to determine if you need to add just expenses or expenses.company.com as the host header)

This works... it involves a bit of fiddling and compromise sure but it works. We do this with some of our internal services. As Ben notes in his comment to Jon Angliss' good answer, sometimes you have to accept a bit of work and compromise.

share|improve this answer

DNS knows nothing about urls. So doing it with dns is impossible. What you can do is setup a proxy server that all clients must use to access the web and you can do it that way.

Or just have a www proxy before your webserver that proxies requests based on yours to the correct IP

share|improve this answer
    
Surely there must be an easier way to implement this? A proxy seems slightly long winded for this. You're right in that all DNS does is convert URL to IP; I'm just curious as to how OpenDNS does it. Thanks for the reply btw. –  emtunc Jan 15 '11 at 15:10
    
their shortcuts from what I understand are just like typing in mail and it goes to gmail.com. Their search domain is set to like opendns.com and if you type mail.. It first looks for mail.opendns.com and the A record would point to gmail.com's IP address. They probably just have a different search domain for each user. –  Mike Jan 15 '11 at 15:21

I've always been confused about this myself. So apparently you need a combo of DNS CNAME and HTTP Redirects. DNS relates a DNS name to an IP address in the case of an A record. A CNAME is an alias for an A record. Whereas HTTP redirect deals with URLs.

Someone over at brighthub wrote a howto do this for a internal helpdesk url shortcut.

In short the steps are:

  1. Setup a cname record on your DNS server for each desired shortcut
  2. Setup HTTP redirects for each desired shortcut using your web server (IIS is used in the howto)
  3. Add the redirect code to your index.html file

<meta http-equiv="Refresh" content="0;URL=http://www.mydomain.com/newpage.html"/>

share|improve this answer

You mention that this is a windows environment, but don't tell us what the websites are hosted on. I'm guessing Windows too, but assuming 2008 as you don't state. If you have IIS installed on the server hosting "domain.com" and all the sub folders, you will want to install the URL Rewrite module (details can be found here).

Once installed, you will need to create DNS entries for "Expenses", and "tracker". These can be CNAME/Alias records pointing to the domain.com entry. Once created, open a cmd prompt on a desktop machine, and type:

ipconfig /flushdns
ping expenses
ping domain.com

The response for both ping statements should have the same IP address. Once DNS has been confirmed working, you will need to go to the web server hosting domain.com, and create an IIS rewrite rule that looks something like this:

<rule name="Canonical Host Name" stopProcessing="true">
  <match url="(.*)" />
    <conditions>
      <add input="{HTTP_HOST}" pattern="^expenses$" />
    </conditions>
  <action type="Redirect" url="http://company.com/expenses" redirectType="Permanent" />
</rule>

That should at least be enough to get you started. Repeat for any other "quick " names you want to use.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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