Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

Block someone masking their domain to your site

Joined
Sep 17, 2012
Posts
407
Reaction score
75
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.
 
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.
 

Rule #1: Be Respectful

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

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.
  • Siusaidh AcornBot:
    Siusaidh has left the room.
      Siusaidh AcornBot: Siusaidh has left the room.
      Top Bottom