There’s something wrong with my page tab – I got a Facebook notification that someone commented in the comment box on my page tab, StackOverflow clicked on the link and I was taken to the page on my site directly:
Here’s the url that took me there:
How can I fix this, StackOverflow that the url the user clicks in their Facebook notification will take them here instead: http://www.Facebook.com/SEHabitat?sk=app_175821802509443
Daniel Tsyganok’s answer is a server side solution and is good and tamper-proof.
However, if you have people behind proxies that strip the HTTP referer field, a less secure way is to use JavaScript.