{"id":5664,"date":"2020-05-18T14:07:09","date_gmt":"2020-05-18T08:37:09","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=5664"},"modified":"2020-05-18T14:07:14","modified_gmt":"2020-05-18T08:37:14","slug":"how-to-block-ips-via-htaccess-file","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-block-ips-via-htaccess-file\/","title":{"rendered":"How to block ips via .htaccess file ?"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">How to block ips via .htaccess file ?<\/h4>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>DATE &#8211; 09-05-2020<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img fetchpriority=\"high\" decoding=\"async\" width=\"861\" height=\"588\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/wp-filezilla-directory-htaccess-4ec66707cf2cf9a75f9d27e19f0f1d515eeee9f804ceec547f951f2c7b8ba40d.jpg\" alt=\"\" data-id=\"5713\" data-full-url=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/wp-filezilla-directory-htaccess-4ec66707cf2cf9a75f9d27e19f0f1d515eeee9f804ceec547f951f2c7b8ba40d.jpg\" data-link=\"https:\/\/pheonixsolutions.com\/blog\/?attachment_id=5713\" class=\"wp-image-5713\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/wp-filezilla-directory-htaccess-4ec66707cf2cf9a75f9d27e19f0f1d515eeee9f804ceec547f951f2c7b8ba40d.jpg 861w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/wp-filezilla-directory-htaccess-4ec66707cf2cf9a75f9d27e19f0f1d515eeee9f804ceec547f951f2c7b8ba40d-300x205.jpg 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/wp-filezilla-directory-htaccess-4ec66707cf2cf9a75f9d27e19f0f1d515eeee9f804ceec547f951f2c7b8ba40d-768x524.jpg 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/wp-filezilla-directory-htaccess-4ec66707cf2cf9a75f9d27e19f0f1d515eeee9f804ceec547f951f2c7b8ba40d-439x300.jpg 439w\" sizes=\"(max-width: 861px) 100vw, 861px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You can quickly block IP addresses from accessing your sites or specific folders using a .htaccess file. Note that the &#8216;.&#8217; in front of htaccess makes this a hidden file. Please make sure your have the&nbsp; &#8216;View Hidden Files&#8217; option checked in your FTP program or through File Manager.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you do not already have a .htaccess file, you can create or upload a new file and name it &#8216;.htaccess&#8217;. To block access to your entire site, add the .htaccess file under the public_html folder. To block access to a specific folder, add the .htaccess file within that folder.&nbsp; For example, to block access to http:\/\/domain.com\/dev, add the .htaccess file under the public_html\/dev folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To block IPs, add the following lines in the .htaccess file:<\/p>\n\n\n\n<p class=\"has-text-color has-vivid-cyan-blue-color wp-block-paragraph\">order allow,deny<br>deny from 290.0.0.0<br>deny from 111.111.1.1<br>allow from all<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This will block IPs 290.0.0.0 and 111.111.1.1 from access your files. To add more blocks, simply add more &#8220;deny from IP_ADDRESS&#8221; lines above the allow from all line.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You may find that you need to block access to a folder for everyone except you, or your developers. To block access for everyone except for specific IPs, add the following to your .htaccess file:<\/p>\n\n\n\n<p class=\"has-text-color has-vivid-cyan-blue-color wp-block-paragraph\">order allow,deny<br>allow from 255.0.0.0<br>allow from 2.2.2.2<br>deny from all<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to block ips via .htaccess file ? DATE &#8211; 09-05-2020 You can quickly block IP addresses from accessing your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1024],"tags":[365],"class_list":["post-5664","post","type-post","status-publish","format-standard","hentry","category-security","tag-htaccess","psol-cat-security"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1tm","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=5664"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5664\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=5664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=5664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=5664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}