{"id":1389,"date":"2020-06-07T02:52:13","date_gmt":"2020-06-06T18:52:13","guid":{"rendered":"https:\/\/www.wesbytes.com\/guide\/?post_type=kb&#038;p=1389"},"modified":"2026-01-13T16:32:53","modified_gmt":"2026-01-13T08:32:53","slug":"how-do-i-whitelist-cloudflares-ips-in-htaccess","status":"publish","type":"kb","link":"https:\/\/www.servergigabit.com\/guide\/kb\/how-do-i-whitelist-cloudflares-ips-in-htaccess","title":{"rendered":"Essential Tutorial: Whitelisting Cloudflare IPs in .htaccess the Right Way"},"content":{"rendered":"<h3><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/royalhost.net\/blog\/wp-content\/uploads\/2023\/06\/htaccess.webp\" alt=\".htaccess\" width=\"473\" height=\"318\" \/><\/h3>\n<h3><strong>How do I whitelist Cloudflare\u2019s IPs in .htaccess?<\/strong><\/h3>\n<p>You would put these commands in .htaccess to whitelist\u00a0<a href=\"https:\/\/www.cloudflare.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare\u2019s<\/a>\u00a0IP addresses:<\/p>\n<p><img decoding=\"async\" class=\"\" src=\"https:\/\/magnusgulf.com\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-9-2025-06_41_57-PM.png\" alt=\"IPv4 vs IPv6: What's the Difference and Why Does It Matter?\" width=\"495\" height=\"330\" \/><\/p>\n<p>(IPv4)<\/p>\n<p>Allow from 173.245.48.0\/20<br \/>\nAllow from 103.21.244.0\/22<br \/>\nAllow from 103.22.200.0\/22<br \/>\nAllow from 103.31.4.0\/22<br \/>\nAllow from 141.101.64.0\/18<br \/>\nAllow from 108.162.192.0\/18<br \/>\nAllow from 190.93.240.0\/20<br \/>\nAllow from 188.114.96.0\/20<br \/>\nAllow from 197.234.240.0\/22<br \/>\nAllow from 198.41.128.0\/17<br \/>\nAllow from 162.158.0.0\/15<br \/>\nAllow from\u00a0104.16.0.0\/12<br \/>\nAllow from 172.64.0.0\/13<\/p>\n<p>(IPv6)<\/p>\n<p>Allow from 2400:cb00::\/32<br \/>\nAllow from 2405:8100::\/32<br \/>\nAllow from 2405:b500::\/32<br \/>\nAllow from 2606:4700::\/32<br \/>\nAllow from 2803:f800::\/32<br \/>\nAllow from 2c0f:f248::\/32<br \/>\nAllow from 2a06:98c0::\/29<\/p>\n<p>Please note: These ips should also be whitlelisted in \/etc\/csf\/csf.allow and \/etc\/csf\/csf.ignore.<\/p>\n<p>&nbsp;<\/p>\n<p>For additional step-by-step guidance or clarification, you can refer to our <a href=\"https:\/\/www.servergigabit.com\/guide\/\">comprehensive guide<\/a> for more help.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/www.cloud.studio\/wp-content\/uploads\/2025\/02\/CloudFlare-dilema-1.webp\" alt=\"Cloudflare explained: its impact on the internet and what happens when it fails | Cloud Studio IoT\" width=\"503\" height=\"283\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How do I whitelist Cloudflare\u2019s IPs in .htaccess? You would put these commands in .htaccess to whitelist\u00a0Cloudflare\u2019s\u00a0IP addresses: (IPv4) Allow from 173.245.48.0\/20 Allow from 103.21.244.0\/22 Allow from 103.22.200.0\/22 Allow from 103.31.4.0\/22 Allow from 141.101.64.0\/18 Allow from 108.162.192.0\/18 Allow from 190.93.240.0\/20 Allow from 188.114.96.0\/20 Allow from 197.234.240.0\/22 Allow from 198.41.128.0\/17 Allow from 162.158.0.0\/15 Allow from\u00a0104.16.0.0\/12 Allow from 172.64.0.0\/13 (IPv6) Allow from&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"kbtopic":[43],"kbtag":[1494,1495],"class_list":["post-1389","kb","type-kb","status-publish","hentry","kbtopic-cloudflare","kbtag-htaccess","kbtag-cloudflare-ip"],"_links":{"self":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/comments?post=1389"}],"version-history":[{"count":3,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1389\/revisions"}],"predecessor-version":[{"id":6161,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1389\/revisions\/6161"}],"wp:attachment":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/media?parent=1389"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=1389"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtag?post=1389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}