Changing “/” to “%2f” in URL doesn't work

◇◆丶佛笑我妖孽 提交于 2019-11-28 03:13:16

问题


I have an orchard site and have the following problem:

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.

Why can / not be replaced by %2f?


回答1:


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).

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 encoding converts characters into a format that can be transmitted over the Internet. - w3Schools

So, "/" is actually a seperator, but "%2f" becomes an ordinary character that simply represents "/" character in element of your url.



来源:https://stackoverflow.com/questions/13210589/changing-to-2f-in-url-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!