How to Implement URL Routing with PHP + IIS?

三世轮回 提交于 2019-12-19 09:43:13

问题


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?


回答1:


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

Take a look at http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module




回答2:


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.




回答3:


Take a look at ISAPI Rewrite.



来源:https://stackoverflow.com/questions/1386521/how-to-implement-url-routing-with-php-iis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!