-3

Yesterday i found another site that use my content i mean not just content it's a full my site... something like they using proxy and display all from mysite, any changes i make, this is displayed on another domain

I just checked IP and they don't use my ip, but there is any chance to protect this... im on apache, dedicated server with dedicated IP....

i was try to make something in php for example if(&_SERVER[HTTP_HOST] != 'mysite.com'){redirect.....}

But later i was checked and they have also same [HTTP_HOST] as my site...

user994461
  • 133
  • 5
  • Is the other domain just pointing to your host and you are serving the content yourself? – Sven Dec 25 '15 at 16:05
  • Yes i think... they is just pointed to my server and display my site to their domain... – user994461 Dec 25 '15 at 16:09
  • 1
    Then configure your web server to don't do this - you need to make the default site something not showing your content. E.g. http://serverfault.com/questions/495927/setup-default-page-for-apache-virtual-hosts – Sven Dec 25 '15 at 16:16
  • I already make config, but problem is still there this is something like this http://meta.stackexchange.com/questions/250916/what-is-stackoverflow-com-80bola-com – user994461 Dec 25 '15 at 16:39
  • 4
    Please make it clear what problem you face. Having a site proxying your content is something different than having a 3rd party domain pointing to your web server. If you can't find out the difference yourself, you shouldn't operate the server in the first place. – Sven Dec 25 '15 at 16:41
  • My fault I'm not explained situation... yes 3rd party domain pointing to my server and all what i need is to block it – user994461 Dec 25 '15 at 16:47

2 Answers2

2

All you need to do is create a vhost for the third party domain name and then return whatever data you want to it.

<VirtualHost *:80>
    ServerName thirdparty.example.com
    ServerAlias *.example.com
    DocumentRoot /var/www/thirdparty
</VirtualHost>

Now you can send anything you want back to them.

Jenny D
  • 27,780
  • 21
  • 75
  • 114
user9517
  • 115,471
  • 20
  • 215
  • 297
  • I was try this method with vhost but does not working, i was try now with php and this trick is working, but it's not what i need....`if($_SERVER['HTTP_X_REAL_IP'] == '62.210.181.99'){header('Location: http://google.com/');}` – user994461 Dec 25 '15 at 20:08
1

Iain's answer is technically correct. However, from your current set up, it seems like your site is actually on the default configuration and is answering all requests to your server. You can double check this by simply typing in your IP address, instead of the domain, in any browser. If your site still shows up, then it is the default site.

When you set up Virtual Hosts, Apache answers them in the order presented. Therefore, you need to put Iain's code as the first host in your Apache configuration.

If your Apache configuration uses split files, you can disable the default host, and move your site to an individual virtual host. Then, the order of VHosts does not matter, as long as no domains or server aliases overlap.

Felix Jen
  • 403
  • 5
  • 18
  • 1
    In a correctly configured name based virtual host system order shouldn't matter unless you're not matching the host header correctly in a ServerName or ServerAlias at which point, yes the default (first defined) vhost gets served. – user9517 Jan 02 '16 at 06:56
  • 1
    According to Apache docs, "If the client provided a Host: header field the list is searched for a matching vhost and **the first hit on a ServerName or ServerAlias is taken** and the request is served from that host." From that, I believe that Apache actually treat's the default VHost's Server Name (if it's a wildcard) to match everything? – Felix Jen Jan 02 '16 at 07:16
  • 1
    ServerName can't be a wildcard. But you're right ServerAlias could be `*` and that might throw a spanner of misconfiguration n the works. – user9517 Jan 02 '16 at 07:29
  • Yep! That's what I meant! But, like you said, that's a terrible and unnecessary configuration. – Felix Jen Jan 02 '16 at 07:35