我可以使用 WebBroker 和 Delphi 创建干净的 URL 吗?

发布于 2024-09-27 08:52:59 字数 299 浏览 0 评论 0原文

我可以为网上经纪服务网页/应用程序创建一个干净的 URL 吗?

典型的网上经纪商 URL 通常如下所示:

hxxp://www.mywebsite.com/myapp.dll?name=fred

hxxp://www.mywebsite.com/myapp.dll/names/fred

我更喜欢的是:

hxxp ://www.mywebsite.com/names/fred

知道如何使用 Delphi/WebBroker 实现此目的吗? (ISAPI/阿帕奇)

Can I create a clean URL for WebBroker webpages/applications ?

A typical WebBroker URL normally looks like:

hxxp://www.mywebsite.com/myapp.dll?name=fred

or

hxxp://www.mywebsite.com/myapp.dll/names/fred

What I would prefer is:

hxxp://www.mywebsite.com/names/fred

Any idea how I can achieve this with Delphi/WebBroker ? (ISAPI/Apache)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月依秋水 2024-10-04 08:52:59

执行此操作的典型方法是使用 apache 的 mod_rewrite 将请求重定向到带参数的 url。许多应用程序这样做是为了创建“人类可读”且对搜索引擎更友好的 URL。

例如,您可以添加此规则以使 action=sales&year=2009 看起来像 sales-2009.htm:

RewriteRule ^sales-2009.htm?$ index.php?action=sales&y=2009 [L]

当用户转到“sales-2009.htm”时,它实际上使用适当的参数重定向到 php 页面。但对于最终用户来说,它仍然在浏览器的地址栏中显示 sales-2009.htm。

当然,您可以使用带 mod_rewrite 的正则表达式,这样您就可以使重定向更加灵活。例如,您可以在上面的示例中创建一个表达式,将任何年份映射到正确的参数。

The typical way of doing this is to use apache's mod_rewrite to redirect requests to the url w/ parameters. Many, many applications do this to create 'human readable' and more search engine friendly urls.

For example, you might add this rule to make action=sales&year=2009 look like sales-2009.htm:

RewriteRule ^sales-2009.htm?$ index.php?action=sales&y=2009 [L]

When the user goes to 'sales-2009.htm', its actually redirected to the php page with the appropriate parameters. To the end user, though, it still displays sales-2009.htm in the browser's url bar.

You can, of course, use regular expressions w/ mod_rewrite, such that you can make the redirections much more flexible. You could, for example, make a single expression in the above example that would map any year to the correct parameter.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文