9

This is kind of a weird request. For some reason whoever owns safeandbuy.com has pointed their domain at my IP address. The reason it's a problem is that I'm having all kinds of crawlers that are trying to crawl my site with that domain name.

Is there anything I can do about this?

Micah
  • 344

5 Answers5

27

You could set up a virtualhost on your webserver for safeandbuy.com to grab all that traffic, and just have an index page that says "I am not safeandbuy.com". That would at least pull the hits out of your actual domain.

The whois information for safeandbuy.com has a contact phone number, address and email. You could try to contact them and let them know they are pointing to the wrong IP.

Alex
  • 6,723
2

Ok here is something that can be very good to do:

Add this under your "header" section at the top of your index page:

<base href="http://www.mydomain.com" target="_top"/>

(Complements of BillThor whos is a very senior member on this site)

By doing this, the person who has his domain pointed to yours .. once someone gets there and clicks on a link, it will redirect them to use your links so they only can steal the home page link and nothing else).

Unfortunately there is no way to stop these kind of people. but all you can do is do a redirect back to your links from his domain.

Another permanent fix to this pesky problem.

It depends on what server program you are using, but for, apache2 has its virtual host settings in the '/etc/apache2/site-enabled' directory. Basically, it has a default virtual hosts ('000-default') and this is set for the mydomain.com site for now. Thus, here is my approach.

  1. Copy the current 000-default to 010-somename. (Please be careful, 000-default is usually symbolic link file so you have to copy it from ../site-available/default.)

  2. Set the virtual host setting in 010-somename. Add these two lines below the first line

    '<VirtualHost *:80>':
    ServerName www.mydomain.com
    ServerAlias mydomain.com
    
  3. Make 000-default points to other directory (elsewhere). In '000-default' file, change 'DocumentRoot /var/www' to point other location like 'DocumentRoot /var/www-test'. The directory /var/www-test don't need to exists, If it is not exists, the connections using other domain name will get error.

  4. Restart apache2 : "sudo /etc/init.d/apache2 restart"

I hope this is helpful.

Zypher
  • 37,829
1

There's nothing you can do to prevent them from pointing their domain at your site. However, you will always get a "HOST" header from the browser, and it will tell you what the domain was that sent the user there.

You could have your server do all sorts of things with this. I don't know what code your server is written in. Maybe you have nginx in front, or maybe you're running apache, or maybe you're just running raw php or Go. But they will all let you do the equivalent of:

if request["HOST"] != 'yourdomainname.com' {
    return differentContent.

If you think it was a harmless mistake, you could return a short html page saying

This site is temporarily down due to misconfiguration.

Attention webmaster: Please correct your DNS settings.

Given you said it's in China, it's probably someone pointing their domain to your site for a while so they get a good reputation with google, and then they'll change to a scammer site. If so -- screw them. Configure your server to return a redirect to a dirty porn site as someone mentioned in this case. But ONLY if you check the request["HOST"] and make sure it doesn't match yours, so you don't screw up your site too :).

And given that we're in the ChatGPT world, you could get help there. I'd ask it something like:

Someone has illegitimately pointed a DNS record to the IP address hosting my website. I want to set up a redirect for them. I'm using [tell them your tool, e.g. apache or nginx, or your programming language if you're not using one, e.g. node, Golang, php]. Can you help me redirect all requests that don't send the HOST header of [your web site] to example.com?

And then change example.com to whatever fun site you might prefer.

John Gibb
  • 111
0

Adding a default virtual host that redirects to a 403 or 404 as others have stated is a solid option. If you want something you can quickly add to your .htaccess file you can do the following to block unofficial domains (requires Apache 2.4 and having mod_rewrite enabled):

# Send requests that don't match domain name to a 404 page
<If "req('Host') !~ /your-domain-name.com/i && req('Host') != 'your.ip.address'">
  RewriteRule ^ - [R=404,L]
</If>

Note: If you have multiple spellings of your domain name pointed to the same IP address you would need to modify the expression to include all valid domain names for the IP address.

PeterA
  • 181
-2

Try using Php to identify the URL of the webpage

if(strpos( $_SERVER['HTTP_HOST'], 'yoururl.com') !== false){
    echo "This is Genuine Yoururl.com";
} else {
    header('Location: http://www.yoururl.com.com/'); exit; // Someone has opened your site as iframe or is using A record to point toward your website
}