Securing Website through .htaccess behind CloudFlare or CDN

access-denied

By default, when you want to block or allow some IP(s) from your website, you may simply do it as the following rules from .htaccess,

order deny,allow
deny from all
allow from 1.1.1.1
allow from 2.2.2.2

However, if you are using service like CloudFlare or other CDN service, you can not do like this as Apache do not understand your visitor IP.

To do that, you need to do like rules below,

SetEnvIf X-FORWARDED-FOR 1.1.1.1 allow
SetEnvIf X-FORWARDED-FOR 2.2.2.2 allow
order deny,allow
deny from all
allow from env=allow

If you need it for IP ranges or network block such as 1.1.1.0/24, you may do it like,

SetEnvIf X-FORWARDED-FOR "^1\.1\.1\.*" allow
order deny,allow
deny from all
allow from env=allow

Free CDN service for your website

By using CDN(Content Delivery Network), it could help your website loading faster as CDN nodes contain the static data that nearer to the public user who access to it.

Among the CDN provider, CloudFlare is now offer with free CDN service. Sign up them by today and you could get the services for free.
https://www.cloudflare.com/plans

How to Configure WordPress to Use CDN(Content Delivery Network)

As you know, MickGenie.com is running with CDN as my previous post on http://www.mickgenie.com/mickgenie-com-live-with-content-delivery-network/. Mick Genie found out the website loading time actually faster than earlier.

Now, Mick Genie going to guide you how to install CDN and configure it with your WordPress.

What is CDN(Content Delivery Network)?
Content Delivery Network as known as Content Distribution Network (CDN) is a computer system contain a copies of static data of your blog from the central server from the world.

Advantage to get CDN

  • Speed – With CDN, all of your static file such as image, javascript, etc will store to the CDN central server. You will get the latest cache file from the central server depend on your Geographically area, hence the speed load will be faster than usual.
  • Security – With CDN, it adds additional of the security level, CDN concept said that when your bottleneck under attack, all of the attack not going through to your hosted server only, but it is actually separate to all of the central server and the attack level will slow down.
  • Availability – With large network of the central server, the availability of the network is better than single server.

CDN Provider
There are some CDN provider by now, and mickgenie.com actually using services from ExaBytes Network.

How to Install CDN
Step 1: Get the CDN provider.
If you interested to purchase CDN services, you may contact ExaBytes Sales team here.

Continue reading How to Configure WordPress to Use CDN(Content Delivery Network)