CloudFlare Visits Only

This rewrite rule is commonly used in .htaccess files to block requests that do not include the CF-RAY header, which is added by Cloudflare. If you'd like a clearer or optimized version of this, it might look the same as it's already efficient, but here’s a slightly adjusted explanation for better readability:


# Block requests missing the Cloudflare CF-RAY header
RewriteCond %{HTTP:CF-RAY} ^$
RewriteRule .* - [F,L]


Explanation:

  1. RewriteCond %{HTTP:CF-RAY} ^$:
    • This checks if the CF-RAY header is missing or empty.
  2. RewriteRule .* - [F,L]:
    • .* matches any request.
    • - indicates no substitution for the request URL.
    • [F,L]:
      • F: Forces the response to be a 403 Forbidden.
      • L: Stops processing further rules.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article