When links doesn’t work and unexpected permalink problems
Or have done any changes to your permalink structure.
In wordpress admin:
Navigate to Settings -> Permalinks.
Thats it – You automatically ‘trigger’ some things that updates your links.
If that doesn’t work, you have done something wrong in the code…