Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found a solution as IIRF. please read the accepted answer

I haven't worked with Windows Server / IIS before and thus I am finding it a little difficult to deal with it. I even don't know if both of them are the same thing.

The scenario is like this:

I have two versions of one site, a .com one for PC viewers, a .mobi one for mobile phones. I want to redirect all the mobile phone (smartphone) user coming to .com site to .mobi site. I'll be using wurfl for detecting the accessing device's type, and all of this stuff works pretty fine with the php script I wrote.

Since the home page of the site is a plain html, I can't use any PHP script in it. I also can't change the page to a PHP script since default.htm is needed by the SEO guys, I don't know why.

I was wishing to have web.config (or anything else) written the way that it rewrites all the URL requests coming to default.htm to default.php where I can make the detector script work, and this script further decides where to send the user.

I don't know anything about web.config, I just found out that its similar to .htaccess Please tell me something about it. The server has various sites and its only one site that we would want to have this functionality. Should I put the web.config inside the folder of this particular site?


I found out by the answers and the comments that web.config works only with the ASP.NET applications while I don't have any ASP.NET environment set at the server.

I also can't use the IIS URLRewrite module since its works with IIS7+ and I have IIS 6.0.

Is there any way out?

share|improve this question

A web.config file is a configuration file for an ASP.NET application. Given you don't appear to be running an ASP.NET app, you probably don't want this.

I think what you're trying to do is possible within the IIS URLWrite module, given that that can issue redirects based on conditionals, such as the useragent containing certain strings and the presence of particular headers.

I'd do some research into the URLRewrite module (it's a separate download for IIS I think).

share|improve this answer
a lot of useful information, but I don't have enough privileges to make server-wide changes, if it requires some. I'll see to it. Can you please provide some sample code too? – Sheikh Aman Apr 1 '11 at 9:16
web.config can only control or enable features that are installed at the server level. You may need to ask the server admins which features are available for HTTP redirection and URL Rewriting. If you want do do it through code, I'd do something like check the user-agent of the connecting client, and redirect to a mobi page if need be. You'd want to keep it pretty lightweight if it's running on every request. – TristanK Apr 4 '11 at 11:18
I agree, web.config will work for ASP.NET applications, so its not useful in my case. I tried to explore URLRewrite module from IIS, but its only supported on IIS7+, while I have IIS6.0. I am updating my question with more info. Any idea what can I do now? – Sheikh Aman Apr 7 '11 at 9:22
I have answered this question, since I found something that you can call as a solution to this problem. – Sheikh Aman Apr 8 '11 at 6:35
up vote 0 down vote accepted

Since I couldn't use web.config as ASP.NET wasn't configured on the concerned server, and since IIS URLRewrite module only on the IIS version 7 and above, I had to find a solution which could get me something similar to what ISAPI_Rewrite engine and still be free/less costly, I found IIRF to be my solution.

I tried it on my Windows XP running IIS6.0, and after spending a little bit of time with it, I could get what I wanted.

You might also want to check IIRF our here. It's free and Open Source solution to URL Rewriting requirements on IIS

share|improve this answer

Your Answer


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.