jonbad Posted February 25, 2012 Report Share Posted February 25, 2012 I have a few sites from China that must have their DNS pointing to my site’s IP address. If you enter their domain into the address bar of a browser, you get my site but their domain in the address bar. I’m not sure what their purpose of doing this is, but they have three of the top four search results when I search for my site on Google. Frustrating. Using the .htaccess file I’ve put in a rewrite condition and rule so if the incoming domain is NOT mine it will basically refresh to my domain. RewriteCond %{HTTP_HOST} !^(www\.)?myDomainName\.com$ [NC] RewriteRule (.*) http://www. myDomainName.com/$1 [R=301,L] But I don’t want to do this. I’d rather have anyone coming from those Chinese sites get a 404 Not Found message. I don’t really want to use a custom 404 page because – if I have this correct – they will still get to my site for the custom 404 page to be shown. I don’t want them on my site at all – I just want them to get the browser’s 404 message like the site does not exist. So, my question is what is the syntax for the RewriteRule to do this? Something like RewriteRule (.*) 404/$1 [R=301,L] ? I’ve searched Google, but haven’t come up with anything definite, so I really could use some help. Thank you for your help. Quote Link to comment Share on other sites More sharing options...
jonbad Posted February 28, 2012 Author Report Share Posted February 28, 2012 I guess what I'm asking can't be done then, since no one has replied. Quote Link to comment Share on other sites More sharing options...
joris121 Posted April 22, 2012 Report Share Posted April 22, 2012 RewriteCond %{HTTP_HOST} !^(www\.)?myDomainName\.com$ [NC] RewriteRule ^(.*)$ - [R=404,L] edit ^(.*)$ to whatever you want to match. should work, not tested though. ntclick 1 Quote Link to comment Share on other sites More sharing options...
david0645 Posted November 8, 2013 Report Share Posted November 8, 2013 That could be a mistake, you could contact the hosting company that has the domains. To stop that access to your site, and to prevent your site from being a training ground for chinese hackers, simply block all chinese IP addresses using htaccess. The lists are available online. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.