This is just a response to say this was resolved. After trying all sorts of things I did the ol’ ‘turn off all plugins’ and the problem seems to be solved by having WordFence turned off. I did some searches for WordFence and ‘permalinks’ but I’ve not found anything specific, but clearly there is a conflict between WordFence and the URLs which are used when trying to display a gallery on an album page.