Can . (period) be part of the path part of an URL?

后端 未结 4 1340
难免孤独
难免孤独 2020-12-15 03:40

Is the following URL valid?

http://www.example.com/module.php/lib/lib.php

According to http://tools.ietf.org/html/rfc1738 section the hpath element of an UR

4条回答
  •  [愿得一人]
    2020-12-15 04:06

    As other answers have noted, periods are allowed in URLs, however you need to be careful. If a single or double period is used in part of a URL's path, the browser will treat it as a change in the path, and you may not get the behavior you want.

    For example:

    • www.example.com/foo/./ redirects to www.example.com/foo/
    • www.example.com/foo/../ redirects to www.example.com/

    Whereas the following will not redirect:

    • www.example.com/foo/bar.biz/
    • www.example.com/foo/..biz/
    • www.example.com/foo/biz../

提交回复
热议问题