Step One: Set Up a CloudFlare Account
The first step, of course, is to set up your CloudFlare account and add your website to it. This process is child’s play and CloudFlare will provide you with all the necessary explanations to make it clear what you need to do. Basically, the whole process consists of three steps:
- You add the domain name to your CloudFlare account
- CloudFlare retrieves as much data as possible from your DNS. You check against your own DNS data whether they are correct and supplement this data if necessary.
- You enter the new ‘Name Server’ details that CloudFlare provides you with at your ‘registrar’, the party where you registered your domain name.
And between seconds and hours from now, your site will be protected and accelerated by CloudFlare. The moment your site is ‘seen’ by CloudFlare, you proceed to step 2. You can check whether this is the case by going to the site ‘ping.eu’, choosing the option ‘Ping’ and entering the name of your website (wordxpression.com for example, without the http). If the list of data shows your new CloudFlare IP address, your site will now run through CloudFlare. Because some operating systems and browsers cache the IP address, it’s a good idea to restart your computer.
Step 2: You only want one website, not two!
Google considers www.servermeister.com and servermeister.com to be two separate websites. And because the same can be read on both websites, Google also goes so far as to think that there are two websites with ‘duplicate content’. And that costs you points. WordPress has solved this very well by allowing you to set whether or not you want to use ‘www’, for example, if you type www.servermeister.com, WordPress itself will rewrite the URL as servermeister.com. However, if you use CloudFlare, this advantage disappears. Your site is both with and without www. and nothing is rewritten. At least not if you don’t tell CloudFlare that this has to happen first. In our example, we assume that you have your website running without www. So servermeister.com instead of www.servermeister.com. If the opposite is the case, then do the opposite of what is described below: To fix this further, go to your CloudFlare ‘Dashboard’ and do the following
- Click on the ‘Page Rules’ option
- Click ‘Create page rule’.
- In the field if the url matches www. yourdomain name. ext in (so for example www.servermeister.com)
- In the then the settings are field, choose ‘Forwarding URL’. A number of other fields become visible.
- In the next field, choose 301 – Permanent Redirect.
- And in the last field, enter ‘yourdomainname.ext’ (so for example servermeister.com).
Save the data.
You want to know the IP addresses of your visitors!
From this moment on, your website will work as usual. At least, almost! The problem that remains is that from now on every visitor seems to come from the same IP address, namely the IP address that CloudFlare has linked to your site. This is because CloudFlare will now ‘fetch’ all pages from your server. This ensures, among other things, that comments (and therefore also spam comments) will all be registered at the same address and your spam filter will quickly think that this IP address is a spam address and will therefore refer all comments to the spam folder. Also, every tool for your site statistics will think that all your visitors are from the same city! Of course you want to avoid that. Fortunately, this can be done easily. The WordPress CloudFlare plugin takes care of this. You only have to install and activate it, from then on it will do all the work automatically.