[英]What character can be used instead of / to separate URL path?
In a URL, according to this syntax , I want to use a different delimiter for separating path in a URL.在 URL 中,根据此语法,我想使用不同的分隔符来分隔 URL 中的路径。
For example:例如:
In this URL https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Generic_syntax
, I want to separate wiki/Uniform_Resource_Identifier
with a symbol other than /
, but I want to make sure it does not break the URL syntax formalized by IETF . In this URL
https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Generic_syntax
, I want to separate wiki/Uniform_Resource_Identifier
with a symbol other than /
, but I want to make sure it does not break the URL syntax formalized by IETF .
I am only concerned about the path, how do I separate its components like wiki
and Uniform_Resource_Identifier
我只关心路径,如何分离它的组件,如
wiki
和Uniform_Resource_Identifier
You could use the URL encoding for / %2F
您可以将 URL 编码用于 /
%2F
https://en.wikipedia.org/wiki%2FUniform_Resource_Identifier#Generic_syntax
As far as your application's use of URIs is concerned, the /
is barely more special than any other character, with two weak exceptions:就您的应用程序对 URI 的使用而言,
/
几乎没有比任何其他字符更特别,除了两个弱例外:
/
in your name even if you separate your components by a slash, as in wiki/AC%2FDC
(which has a component AC/DC
after your application does the splitting), but just the same you can separate your components with a ;
wiki/AC%2FDC
AC/DC
组件,您的名字中也可以有/
您的组件带有;
and still have wiki;Steins%3bGate
for Steins;Gate
.wiki;Steins%3bGate
for Steins;Gate
。/
are special in that you can do ../../
on slashes but not with any other delimiter./
的特殊之处在于您可以在斜杠上执行../../
但不能使用任何其他分隔符。 (And this is the only place where the path segments really matter). So really, pick whichever you like for your application;所以真的,选择你喜欢的应用程序; the client should (at least under HATEOAS, or really general REST, assumptions) not put too much meaning to the components anyway.
客户应该(至少在 HATEOAS 下,或真正一般的 REST,假设)无论如何都不要对组件赋予太多意义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.