Correct behaviour for trailing slashes

fixes #2741
- Extend HistoryLocation
- Add trailing slash to path
Merge pull request #2771 from halfdan/2741-trailing-slashes

Correct behaviour for trailing slashes