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

I'm attempting to use the below reference to create a re-direct for my local site with no luck.

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/6b855a7a-0884-4508-ba95-079f38c77017.mspx?mfr=true

I want absolute links on my local site that point online to point to my local site instead.

example absolute link [http://online.com/products]

when I click the local version I'd like it to redirect to: [http://offline/products]

I want to preserve everything after the domain name and append it to the server (local) name so that when I click a link it will redirect to the local site and not the online version.

I've tried [http://offline$S] but that doesn't append the "suffix" /products the way I thought it should.

What's going on here?

share|improve this question

3 Answers 3

Is this just for your developers? I'm still a bit confused on what you're attempting to do. However you can do a few things, some already suggested.

  1. Use Host Files if you can't change DNS which will change resolution for entire company
  2. But if your developers are online ones going to offline.com - create a new local/internal DNS record (host record) for offline.com
  3. Use your redirects on offline.com for the pages where you want the links to go to live content on online.com (basically reverse of what you were thinking - since you do have control of offline.com)

Also, for #3, instead of using iis redirects, try ISAPI rewrite tools. Since its dev, i'm sure you don't want to pay for one - (one i use is Helicon - isapirewrite .com [won't let me post more hyperlinks] $99 /server) but there are free ones - IIRF http://iirf.codeplex.com/ might be a good choice.

share|improve this answer
    
I'll have to look into ISAPI rewrite tools, sounds promising! –  payling Sep 10 '10 at 20:07

Is the computer hosting the 'local' site on the same network as the IIS?

Do you need the option to access both online and offline versions?

share|improve this answer
    
Yes and yes. The main site (online) is hosted off site. I setup iis6 on our internal server for development purposes so I could test it before uploading it to the live site. So I can't redirect all urls for our company to go to the local website, it's meant for just the web developers here. –  payling Sep 7 '10 at 16:38
    
You can accomplish this in a make shift manner by assigning an IP address to the domain name in the hosts file of the computers that want to point to the offline version. On windows machines this file is generally located@ C:\Windows\System32\drivers\etc\hosts if you add 127.0.0.1 onlineurl.com (replace 127.0.0.1 with whatever the internal site IP address is.) you can do it this way. On Linux it's /etc/hosts –  Kyle Buser Sep 7 '10 at 20:38

An IIS redirect isn't going to work for you in this case. For those absolute links your offline IIS server is completely out of the picture. If you look in your IIS logs on offline you should see that none of those requests even make it to that server. Your browser will attempt to directly contact online.come itself and send the request there (by way of any proxy servers in the chain). IIS on offline never gets a chance to handle the request and therefore will not fire any redirect. For an IIS redirect to work the initial request must be served by your IIS server.

To make this work you would need to get creative with dns or internal proxy servers.

share|improve this answer
    
I have little to no experience configuring dns or internal proxy servers. Do you think those are my only solutions other than converting links to relative? –  payling Sep 7 '10 at 14:35
    
@payling: Yes, I do. With the added possibility of using host file entries, but that's a similar issue to creating a dns solution. The issue that you're facing is a name resolution thing which are solved by dns / hosts file entry, or by using a proxy server that knows how to forward the HTTP requests appropriately for your network environment. –  squillman Sep 7 '10 at 14:39
    
I'm not sure if this helps, but the reason why I'm looking to redirect is because I created my site using SSI. The menus, footers, headers etc are all includes and must have absolute links otherwise the links will redirect to the wrong location once the user has traveled to a page in a sub directory. –  payling Sep 7 '10 at 14:53
    
@payling no, not really. An absolute link in the markup that a client uses is just that regardless of how it's generated. The client does not interpret them differently (and has no way of distinguishing differences). –  squillman Sep 7 '10 at 15:23
    
I'm currently considering an option to use SSI conditional statements to determine which url to load. The live site will always use port 80 and the local site is on 81. I could create an ssl statement that says if port 81 load local url else load absolute url. –  payling Sep 7 '10 at 16:41

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.