Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

Block someone masking their domain to your site

Joined
Sep 17, 2012
Posts
400
Reaction score
71
Not really a domain issue, but there seems to be a greater than average knowledge of coding on this forum so thought it may be a good place to ask.

We're recently launched a new site and found that someone is masking or mapping their domain onto our site. It's not scrapped as any edits appear immediately. Looking at the source code there is also no iframe present (hence assuming they're mapping or masking).

And ideas on how to stop them? Ideally just refuse the connection so nothing outputs?
 
Hopefully somebody can give you the exact code, but what could help would be to have a .htaccess file with a section of code that checks whether the current URL matches your domain. If it doesn't then you can serve up an error code of your choice.

In other words, if your site is at sitea.com but it is also showing up at siteb.com because they've mapped siteb.com to your site, then if you check in .htaccess whether the URL browser bar is showing sitea.com or not you can block visits that way.
 
Yeah that's kind of what i was assuming would be needed. No idea how to do it though.
 
Probably some examples of using htaccess to check hostname headers out there somewhere.

Unfortunately I'm IIS-only, so not much use to you :)
 
Excellent - thanks. That worked.

It's a new site so I'm actually thinking it's best to redirect to my site until google settles down and figures out what's going on, then I'll just kill it.

Is there a way to wild card the redirect so that baddomain.com/page goes to gooddomain.com/page?
 
This should work I think...

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

It will redirect everything other than www.domain.com to www.domain.com (bonus: there's no "www" or "no www" confusion at Google's end when they're indexing incoming links to your site) and it should redirect pages/subdirectories correctly. But please test it carefully - I have a slightly tweaked version of the above on one of our sites, but some of the code may be specific to that hosting environment.
 

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom