Improved link handling code

* Properly handles links with or without leading "www"
* Handles regular page links, and links to actual pdf file