What is the difference between a URI, a URL and a URN?

前端 未结 30 1278
小蘑菇
小蘑菇 2020-11-22 02:18

People talk about URLs, URIs, and URNs as if they\'re different things, but they look the same to the naked eye.

W

30条回答
  •  借酒劲吻你
    2020-11-22 02:48

    Although the terms URI and URL are strictly defined, many use the terms for other things than they are defined for.

    Let’s take Apache for example. If http://example.com/foo is requested from an Apache server, you’ll have the following environment variables set:

    • REDIRECT_URL: /foo
    • REQUEST_URI: /foo

    With mod_rewrite enabled, you will also have these variables:

    • REDIRECT_SCRIPT_URL: /foo
    • REDIRECT_SCRIPT_URI: http://example.com/foo
    • SCRIPT_URL: /foo
    • SCRIPT_URI: http://example.com/foo

    This might be the reason for some of the confusion.

提交回复
热议问题