且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何实现像 facebook 或 twitter 这样漂亮的小用户页面 url?

更新时间:2023-12-02 18:50:34

这称为url 重写".在托管应用程序尝试处理它之前,您有一些代码将原始facebook.com/guru"网址转换为facebook.com/?user=guru"网址.

This is called "url rewriting". You have some code that takes the original "facebook.com/guru" URL and coverts it into the "facebook.com/?user=guru" URL before the hosting application tries to process it.

根据您的网络服务器,可能已经构建了一个模块可以让您执行此操作.在 IIS 中,您可以使用自定义 HttpModule 或 URL 重写模块.

Depending on your web server, there is probably a module already built that lets you do this. In IIS, you can either use a custom HttpModule or the URL rewriting module.