I've posted to GitHub a PHP class that I've written which can handle URL normalization, as specified by RFC 3986.
https://github.com/glenscott/url-normalizer
Specifically, the following normalization steps are performed:
- Normalize case
- Decode unreserved characters
- Remove dot segments
An example of use:
require_once 'URLNormalizer.php'; $url = 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'; $un = new URLNormalizer(); $un->setUrl( $url ); echo $un->normalize(); // result: "example://a/b/c/%7Bfoo%7D"