如何进行 mod 重写以更改 url 的符号以用于显示目的?

发布于 2024-10-02 07:29:51 字数 454 浏览 0 评论 0原文

大家好,

我一直在想,谷歌搜索并更快地思考是否有可能 mod 重写将其从 url 获取的特定符号更改为其他符号?

即如果网址是 www.website.com/foo-bar 使用重写规则我可以​​让连字符变成正斜杠?

<?php $foobar = "foo-bar"; ?>

<a href="/<?php echo $foobar; ?>">foo-bar</a>

.htacces 代码我有..

RewriteRule ^([^/]+)$        index.php?page=$1 [L]

所以基本上我想 mod 重写以使地址栏上的 url 显示为 www.website.com/foo/bar 如果可能的话?

问候,

丹。

Good day all,

Ive been wondering, google searching and goign greyer quicker thinking if it is possible for mod rewrite to change a specific symbol it grabs from the url to something else?

i.e. if the url is www.website.com/foo-bar using the rewriterule I can get that hyphen to become a forward slash?

<?php $foobar = "foo-bar"; ?>

<a href="/<?php echo $foobar; ?>">foo-bar</a>

.htacces code I have..

RewriteRule ^([^/]+)$        index.php?page=$1 [L]

So basically I would like mod rewrite to make the url display on the addressbar as www.website.com/foo/bar if possible?

Regards,

Dan.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文