Matthew Steven Kelly

Blocking domain masking

June9

Any website on the internet can be subject to domain masking.

And every website should be setup to prevent it. For example, for some odd reason the site http://www.xsjl.cn/ is setup to mask my website. I have absolutely no idea why, but if you go to http://www.xsjl.cn/ in the browser it takes you to my site, but keeps http://www.xsjl.cn/ in the URL path. So to stop it I added to the following PHP code to the top of my pages.

<?php
$domain = preg_replace("/^(.*\.)?([^.]*\..*)$/", "$2", $_SERVER['HTTP_HOST']);
if($domain != "matthewstevenkelly.com")
{
echo "<html><head><title>Error domain: ".$domain." is invalid!</title></head><body>Error domain: ".$domain." is invalid!<br><br><a href=\"http://who.godaddy.com/whoischeck.aspx?Domain=".$domain."\">http://who.godaddy.com/whoischeck.aspx?Domain=".$domain."</a></body></html>";
exit;
}
?>
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
posted under The Knowledgebase

Email will not be published

Website example

Your Comment: