blocking domains from from cloaking my site

Discussion in 'Apache' started by cosmicsea, Feb 20, 2010.

  1. #1
    Hi I have a problem I need help with. I have a site that i guess you can say is cloaking my website. the domain is pointed at my server ip and is an exact copy of my site. I was able to block it through .htaccess but i would like some help making sure this doesnt happen again.

    my site is a search engine and when i goto the unknown domain it works just like my site does. this is my .htaccess for my root folder and it seems to forward from Unknownsite.com to mysite.com fine.
    
    # turn off directory indexing
    Options -Indexes
    ErrorDocument 404 /index.php
    
    RewriteEngine on
    
    ## Allow access to only http://mysite.com/  (without www)
    
    RewriteCond %{HTTP_HOST} ^www\.mysite\.com [NC]
    RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,NC,L]
     
    RewriteCond %{HTTP_USER_AGENT} libwww [NC,OR] 
    RewriteCond %{QUERY_STRING} ^(.*)=http [NC] 
    RewriteRule ^(.*)$ - [F,L]
    
    RewriteCond %{HTTP_HOST} ^UnknownSite.com$ [NC]
    RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]
    Code (markup):

    This is in my search folder using seo friendly urls.

    # turn off directory indexing
    Options -Indexes
    
    ErrorDocument 404 /search/index.php
    
    RewriteEngine on
    
    # redirect all search traffic to /search/search.php
    RewriteCond %{HTTP_HOST} ^UnknownSite.com$ [NC]
    RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]
    RewriteCond %{REQUEST_URI} ^\/search\/(.*)\/(.*)$
    RewriteCond %{1} !^search.php [NC]
    RewriteRule ^(.*)$ /search/search.php?q=%1&p=%2 [L]
    
    Code (markup):
    this works to make search results on Unknownsite.com to forward to mysite.com

    Can anyone help me so that i can block any site that attempts to point there domain at my ip? I really dont want duplicate results in google etc. it has already started to happen with the site that is doing it now. I dont even see why anyone would do this. But if someone can help me I would appreciate it very much. Thanks.
     
    cosmicsea, Feb 20, 2010 IP