如果正在使用index.php,则删除尾部斜杠

发布于 2024-12-09 23:14:17 字数 658 浏览 0 评论 0原文

我正在开发一项由后端 API 提供支持的新服务,API 的位置如下......

api.nblackburn.me/jobtrackr/

但是如何而不是拥有这个......

api.nblackburn.me/jobtrackr/?action=signin

我可以将其更改为这个...

api.nblackburn.me/jobtrackr?action=signin

而不再次添加。我在几个网站上看到过这样做,并且想知道它是如何完成的,因为尾部斜杠看起来非常不舒服。我知道这只是表面上的改变,但任何帮助都会很棒,再次感谢。

甚至堆栈溢出也在使用这种方法,例如......

https://stackoverflow.com/users/955822/nblackburn?tab=reputation

亲切的问候,
纳撒尼尔·布莱克本

I am working on a new service which is powered by a backend API, the location of the API is as follows...

api.nblackburn.me/jobtrackr/

but how instead of having this...

api.nblackburn.me/jobtrackr/?action=signin

could i change it to this...

api.nblackburn.me/jobtrackr?action=signin

without it being added again. I have seen this being done on several websites and was wondering how its done as the trailing slash is very unpleasant to look at there. I know its only a cosmetic change but any help would be great, thanks again.

Even stack overflow is using this method, for example...

https://stackoverflow.com/users/955822/nblackburn?tab=reputation

Kind Regards,
Nathaniel Blackburn

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

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

发布评论

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

评论(1

匿名。 2024-12-16 23:14:17
Rewrite Rule (.*?)/\?(.*) $1?$2 [NC,P,L]

这样的东西有用吗?

http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Rewrite Rule (.*?)/\?(.*) $1?$2 [NC,P,L]

Does something like this work?

http://httpd.apache.org/docs/current/mod/mod_rewrite.html

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