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

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

问题描述

有没有在URL的末尾有斜杠的问候这些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/

做web框架和Web服务器(例如Apache时,Nginx的,Django的)不同的方式处理这些请求?

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

推荐答案

在Django的网址,没有斜杠自动获得附加给他们一个正斜杠。这是Django的开发商preference,而不是网络(我认为这实际上是在Django的设置)的硬codeD规则。

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天全站免登陆