Reputation: 403
Is it valid and safe to use the parent directory double-dots inside an URL like in the following example:
http://example.com/path/../to/file.jpg
Upvotes: 13
Views: 10453
Reputation: 41271
RFC3986 defines URIs.
It describes how paths are hierarchical, and how...
The path segments "." and "..", also known as dot-segments
... work in a similar way to filesystem paths.
It also describes rules for "relative resolution" in which .
and ..
may be removed.
Essentially, it is legal and does what you expect.
Upvotes: 14
Reputation: 43
Yes it absolutely works.
Just notice that the URL will change so the dots won't be displayed inside it. Like if you do http://path/to/new/../file
the displayed URL will be http://path/to/file
Upvotes: 2