绝对与相对网址 [英] Absolute vs relative URLs

查看:59
本文介绍了绝对与相对网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道这两种类型的网址之间的差异:相对网址(图片,CSS文件,JS文件等)和绝对网址。

另外,哪一个更好用?

解决方案

通常,使用相对URL被认为是最佳做法,以便您的网站不会绑定到当前部署的基本网址。例如,它可以在本地主机以及公共领域上工作,无需修改。


I would like to know the differences between these two types of URLs: relative URLs (for pictures, CSS files, JS files, etc.) and absolute URLs.

In addition, which one is better to use?

解决方案

In general, it is considered best-practice to use relative URLs, so that your website will not be bound to the base URL of where it is currently deployed. For example, it will be able to work on localhost, as well as on your public domain, without modifications.

这篇关于绝对与相对网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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