PDO / HASH Registration form
That's a very good code. Speaking of the things that are written in it, there is very little I would change. Only a few things are coming to my mind, 


I would move the database connection code into a separate file and then just include in other scripts that needed a database connection.
Using the Refresh header is old fashioned, inconvenient and buggy. I would rather redirect a user to the newly created account page. So they would know that an account has been created at once.
I wouldn't hardcode a particular hashing algorithm, and rather use PASSWORD_DEFAULT instead. 


That's all. But of course some things could be added to this code as well. You can add some verifications, like as to see 


if the username is not empty or already exists
whether the password is not strong enough
whether email follows the proper format or already exists
all other verifications you can think of


And for this purpose it is useful to make $msg not a string but an array of strings, to collect all possible errors in one variable. You can check this approach in my recent answer