I need to include a url in my document, which includes this symbol: ~
Simply entering the url generates a space rather than the symbol, and replacing the symbol with $\sim$ is not equivalent, the url no longer works if copied and pasted into a browser. Is there a way to generate the exact symbol? The full url I want to use is http://www.its.caltech.edu/∼ph76a/pdh.pdf.
Working example:

The font style can be set by the \urlstyle command. From url (documentation):

You can switch the style of printing using “\urlstyle{xx}”, where “xx”
can be any defined style. The pre-defined styles are “tt”, “rm”, “sf”
and “same” which all allow the same linebreaks but use different fonts
— the first three select a specific font and the “same” style uses the
current text font. You can define your own styles with different fonts
and/or line-breaking by following the explanations below. The “\url”
command follows whatever the currently-set style dictates.