Fix logic for path alias validation and add test.

#5084 

This PR effectively removes the changes presented in https://github.com/openscholar/openscholar/pull/5116 (excluding comments). 

Also added tests to ensure that alias must include a prefix and that the alias given is not already in use.