views:

124

answers:

2

Is there any way to rewrite an url of a php app on iis? If yes, how

+1  A: 

I recommend that you download Microsoft's Web Platform Installer. With that, you can install URL Rewrite, which is a nice tool that will definitely do the job for you.

Venemo
Ok, but what should i make if i dont have this opportunity?
Nort
What opportunity? Do you mean that you can't install URL Rewrite on the server?
Venemo
Yes, because i have no permission for that :) its not a local machine and not my server.
Nort
If you don't have control over the server or you can't talk to the server's owner, it will be impossible.
Venemo
Maybe, but i'm not so sure. Is there a way to do this, with minimal asp.net? I think some magic with web.config or so? I'm really sure that theres a solution, with no need to install any apps on the server.
Nort
It is possible, for example with ASP.NET routing. But ASP.NET can only handle file extensions which are mapped to ASP.NET. If you use IIS 7 with integrated mode, this is no problem. Otherwise, you'll have to use wildchar mapping. (Which again requires access to the server.)
Venemo
ooook, but whats in that case if i use for e.g. asp.net mvc. theres an automatic url rewrite "module" installed on the mvc framework by default. Does the server handle it only because its asp.net based?
Nort
That "module" is called ASP.NET Routing, and it can only handle files mapped to ASP.NET. If you use IIS 7's integrated mode, it can handle them all, otherwise, only .aspx .ashx .axd, and so on.
Venemo
Oook, then lets solve this without any iis modules, using only asp.net. What is in that case if i have an aspx file that does the routing and calls a php file with the handled query string? Would this work?
Nort
It doesn't work that way. First off, what version of IIS are you using?
Venemo
im using iis7, but on the server is only the version 6 installed.But i have solved the problem, or i hope so. If i create a routed aspx and call my php file as a file with the query string i gave to the aspx, i could print the output i get through the php, because php is also installed on the server :)I really hope that the problem is solved this way :D
Nort
In IIS 6, you can only use Routing with file extensions mapped to ASP.NET. (aspx, ashx, asmx, axd, and so on)
Venemo
But asp.net itself can handle as many extensions as i want. Or?So if i route my asp.net file, as I told IT (i mean, the aspx) can read the php file, with those uri parameters, witch i gave to my aspx file through asp.net routing, and handle the php file like a common file. Im really sure about that.
Nort
ASP.NET can handle any files that are mapped to it, if you set the mapping in IIS.
Venemo
but you don't understand, if i make a file call, to read the content of a file, i can get everything from it, and print it out like an html page.
Nort
Sure, nice. :-)
Venemo
+2  A: 

I've used Ionic's ISAPI Rewrite Filter and i've been happy with it. The developer answers any forum questions you post very quickly

Galen