NiceUrls fix

Fixes issues #314. Thanks to @rkmax for helping out on this one.