These are 2 different things.
Concerning the first: please check minimum requirements (there’s a typo there: minimum php version is 5.6), and check your server logs to see what the error 500 is about.
As for the second: can you use $item->uid()
, or str::slug($item->title())
for both the id and href? This way you shouldn’t have encoding issues.