Rewrite URL path replacement.

Closes #140.