使用 htaccess 重写 url

发布于 2024-12-19 08:59:57 字数 1459 浏览 4 评论 0 原文

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

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

发布评论

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

评论(2

风吹雪碎 2024-12-26 08:59:57

您可以使用外部重写来处理此类事情。这将是一个简单的几行 Perl 脚本。请参阅 apache 文档中的“外部重写程序”。

RewriteMap mapname prg:/path/to/program

You can use external rewriting for such things. This one will be a simple few-line perl script. See apache documentation for "External Rewriting Program".

RewriteMap mapname prg:/path/to/program
神妖 2024-12-26 08:59:57

您应该像在 PHP 中那样处理路径创建,然后将其发送到 HTML 并发送到锚点以供某人单击。它不仅包含会被转换为 %20 并使 URL 不可读的空格,而且还包含大写字母!

没有有效的方法可以有效地小写字母并用破折号替换所有空格。大多数方法都会使用一堆额外的 HTTP 请求。

You should be handling a path creation like that in PHP, before it even gets sent to the HTML and into an anchor for someone to click on. Not only does it contain spaces which will get converted into %20 and make the URL unreadable, it contains uppercase letters!

There is no efficient way to lowercase your letters and replace all the spaces with dashes efficiently. Most methods will use a bunch of extra HTTP requests.

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