1

UPDATE
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?

UPDATE

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?

2 Answers 2

2

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).

4
  • 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?
    – Aman Alam
    Apr 1, 2011 at 9:16
  • 1
    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, 2011 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?
    – Aman Alam
    Apr 7, 2011 at 9:22
  • I have answered this question, since I found something that you can call as a solution to this problem.
    – Aman Alam
    Apr 8, 2011 at 6:35
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .