0

Most web browsers will allow the user to specify:

https://superuser.com/

or

https://superuser.com

But which is technically appropriate, and why?

1 Answer 1

3

Forward slash in URI/URL specification is a separator between the host (or host+port) part and the path.

It is not strictly enforced if the path is not present I the URL.

The first definition in RFC 1738 states that in case of an URL use for HTML:

An HTTP URL takes the form:

 http://<host>:<port>/<path>?<searchpart>

[ ]

If neither nor is present, the "/" may also be omitted.

Later RFC 3986 provides a more detailed guidance towards treating the URL with and without the trailing slash as equivalent:

because the "http" scheme [ ] defines an empty path to be equivalent to "/", the following four URIs are equivalent:

 http://example.com
 http://example.com/
 http://example.com:/
 http://example.com:80/

Following the RFC guidelines, including the / is adhering to the strict form, while omitting it is allowed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .