为什么在 URL 末尾需要斜线? [英] Why would you need a slash at the end of a URL?

查看:23
本文介绍了为什么在 URL 末尾需要斜线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些网址在网址末尾是否有斜杠方面有区别吗?

Is there a difference between these URLs in regards to having slashes at the end of the URL?

https://drchrono.com/about_us
https://drchrono.com/about_us/

网络框架和网络服务器(例如 Apache、Nginx、Django)是否以不同的方式处理这些请求?

Do web frameworks and web servers (e.g. Apache, Nginx, Django) handle these requests differently?

推荐答案

在没有正斜杠的 Django URL 中,会自动附加一个正斜杠.这是 Django 开发人员的偏好,而不是网络的硬编码规则(我认为它实际上是 Django 中的一个设置).

In Django URLs without forward slashes automatically have a forward slash appended to them. This is a preference of the Django developers and not a hard-coded rule of the web (I think it's actually a setting in Django).

这篇关于为什么在 URL 末尾需要斜线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆