views:

296

answers:

4

I wrote a content switcher script that uses dynamic URLs to pass parameters indicating what data is to be sent.

For example to view the about page you would type: http://www.example.com/?page=about

The issue is that this is not user friendly especially in my case where users will not necessarily be accessing this page via a link from the home page.

What I would rather have the URL look like is: http://www.example.com/about/

Unfortunately I am running PHP5 on an IIS platform, not Apache, so this eliminates the most common methods that use mod-rewrite.

I'm looking for examples of how to do URL Routing with PHP + IIS.

Can it be done on the IIS 7.5 platform?

A: 

I'm not familiar with the URL rewriting methods under ISS but what about:

http://www.example.com/index.php/about/

Seems friendly enough to me and you don't need anything besides pure PHP.

Alix Axel
A: 

Take a look at ISAPI Rewrite.

nickf
+4  A: 

Since you're using IIS 7, you can use the new rewriting support that's now available.

Take a look at http://learn.iis.net/page.aspx/460/using-url-rewrite-module/

Jon Benedicto
In addition to that plugin for IIS, the plugin itself includes an import method for htaccess files containing rewrite rules and then creates rules for you in the web.config file. This way you can write the rules in a format you are comfortable with, and import them into IIS later or simply use existing .htaccess files.
Kevin Peno
+1  A: 

IIRF is a rewriting filter that works with IIS (5,6,7, 7.5) and uses configuration syntax that is the same as mod_rewrite.

Since you are using IIS7.5, you can also take advantage of the Rewriting Module from Microsoft.

Both of these work fine with PHP.

Cheeso