Reputation: 1421
I recently hosted my website using github static pages. I am very new to web related things. I found that using .htaccess
file we can block certain countries simply using SetEnvIf CF-IPCountry RU BuzzOff=1
.
But .htaccess
is not supported for github pages. There is a workaround for redirecting web pages.
When I google for blocking access to certain countries for github pages all I get is which countries have blocked github and what github did to undone the block.
Is there a simple way to block website for certain country? Its not about privacy. But I am having unnecessary large no.of visitors from certain country and its very annoying to use Google Analytics because of it.
Upvotes: 1
Views: 1413
Reputation: 128
There is a Javascript solution found at https://github.com/MohamedBassem/spam-referrals-blocker.
From the GitHub repo:
The idea simply is that this repo will use this community-contributed list to create a JS file which will block the spam referral for you. The library will then be updated with the new urls but with the same download url. By having the script automatically included in your website you won't have to update the spam referral list in your google analytics anymore, it will be automatically done for you.
Works with Google Analytics and GitHub / Jekyll.
Upvotes: 1