更改"/"到“%2f"在URL中不起作用 [英] Changing "/" to "%2f" in URL doesn't work
问题描述
我有一个果园站点,并遇到以下问题:
I have an orchard site and have the following problem:
如果我使用URL: http://asiahotelct.com/tours%2fct---chau-%C4%91oc---ha-tien-3n2%C4%91 ),不再起作用.
If I use the URL: http://asiahotelct.com/tours/ct---chau-%C4%91oc---ha-tien-3n2%C4%91, it's okay. But when I change url the /
to %2f
(like so: http://asiahotelct.com/tours%2fct---chau-%C4%91oc---ha-tien-3n2%C4%91), it no longer works.
为什么不能用%2f
代替/
?
推荐答案
任何 url 是一种指向网络中某些资源(文件)的完整地址.但是根据必须实际存在的规则(按照您的期望工作),它期望一些字符必须具有特定的含义;就像在这种情况下一样:"/"表示一个分隔符,用于分隔您的地址(url)的各个元素.
Any url is a kind of complete address to some resource(file) in network. But according to the rules of how it must be actually (to work as you expect), its expected that a few characters must have some specific meaning; just like in this case: "/" means a separator that separates the individual elements of your address(url).
但是如果您需要这样的特定字符作为address(url)的任何 元素的一部分,则必须对其进行编码. 代码列表
But in case you need such specific characters to be a part of any such element of address(url), we must encode it. List of codes
URL编码将字符转换为可以传输的格式 通过互联网. -w3Schools
URL encoding converts characters into a format that can be transmitted over the Internet. - w3Schools
因此,"/" 实际上是一个分隔符,但是%2f" 变成了一个普通字符,仅表示URL元素中的"/"字符.
So, "/" is actually a seperator, but "%2f" becomes an ordinary character that simply represents "/" character in element of your url.
这篇关于更改"/"到“%2f"在URL中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!