How to Restrict a website from being viewed in china.

    I was wondering if there is a way do disable my website from being viewed in china. Any help would be greatly appreciated.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi dave1184,

The primary way to do this would be based upon IP address or Hostname, but these aren't consistent.  You could easily (under Apache) make a RewriteRule that detects the hostname of the other side and if it's from the china suffix, return a Forbidden status code.  Unfortunately, most hosts that will be visiting your site probably don't have a canonical host name (and even if they do, reverse-DNS lookups to find out the hostname can be very expensive if you're experiencing high traffic).  So, you would have to collect a database of the geographical locations of various Class A, B, and C networks, and do a lookup against your database for each request.  This would work in most cases, but many class C networks are shared across multiple geographies, so you would have some Chinese citizens using a class B network from a neighboring country that would be allowed through, and some from neighboring countries using Chinese class C networks that would be denied access.  And, of course, your database would be VERY large.  And the real down side is that anyone could just go through a proxy in another nation, and you'd be unable to tell the difference.

So, the short answer is yes, you could block views from the lower echelon of computer users going through domains or networks that are easily identifiable as Chinese, but you cannot block everyone, and even trying to block a majority of users will require a large amount of overhead and maintenance on your part.

Hope that helps.


Actually, the short answer is no as there's no way to disable the site from being viewed from all of China.  There are a couple of maybe's if just limiting the amount of connections that are possible from China and one somewhat questionable yes that would likely work for just about all of china, but may be a bit much to go through to do it. Really it depends on whether or not you're in china and trying to prevent others there from seeing it or you're outside of china and you have a reason to want people in china to avoid the site.  If it's the former, then as smidgie82 mentioned, you can only limit it as the 'questionable yes' would probably not work out well for you.  If you're outside of China, then there is a way.  The same way that China controls access to the internet in general from their country (How do you think google managed to get china to agree to expanding their search engine to a version for china?).   In other words, you can't technically block all of China from getting to your site, but you can get China to block basically everyone from China from being able to get to your site.   You just need them to want to do so.

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anti-chinese postings can get you shot bro. be careful =) haha
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).


Good point.  I'd forgotten that the Chinese gov't has control over the networks in the nation.  So yeah, getting people in China to be unable to view your site is probably pretty easy.  Just collect all the anti-Chinese propaganda and news stories you can find and post them or links to them on your site.  Should do the trick.  (c:
Well, as I said, it's a 'questionable' method, but, if someone really wanted the site to not be viewable from china for whatever is known to work.
Since we got no feedback from the asker, I'd recommend a delete - no refund.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.