Custom htaccess for wordpress with CF and Flexible SSL?

Is there any custom wordpress htaccess code prevents attackers which compatible with Cloudflare and Flexible SSl?

What are you trying to stop? To stop direct access, I made sure I had IP Geolocation turned on in Cloudflare’s Network tab, then added the following to .htaccess:

RewriteEngine On 
RewriteCond %{HTTP:CF-IPCountry} ^$
RewriteRule ^ - [F,L]

If a visitor came directly to my IP address, it would see they didn’t have the IPCountry header and rewrite the URL to null and not load the site.

I try to build a Cloudflare compatible htaccess file which prevents from sql injections and other hacking attempts.

Can I add codes on this guideline: A Complete Guide to Editing .htaccess for WordPress Security ?

Sure, Cloudflare is pretty transparent in this regard.

Though it’d be easier just to install a security plugin like Wordfence.

The point is I dont want to install a plugin. I just wanna use secure htaccess rules which is compatible with Cloudflare.

Hi vpd, you might want to take a look at the 6G firewall, a free set of htaccess rules by Jeff Starr of Perishable Press

1 Like