{"id":2586,"date":"2020-12-07T05:29:58","date_gmt":"2020-12-07T05:29:58","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=2586"},"modified":"2024-06-19T06:25:05","modified_gmt":"2024-06-19T06:25:05","slug":"apache-restrict-access-to-url-by-ip","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/","title":{"rendered":"Apache Restrict Access by IP"},"content":{"rendered":"\n<p>Often website administrators need to restrict access to URL by IP. This is commonly required if your site is under attack from certain IP addresses or address ranges. You may also need to temporarily block access to your site if you want to do some urgent maintenance or troubleshooting. Apache allows you to limit access to URL by single IP, multiple IP addresses and even IP address ranges. In this article, we will look at how to restrict access to URL by IP. You can use these steps to secure URL in Apache.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#Apache_Restrict_Access_to_URL_by_IP\" >Apache Restrict Access to URL by IP<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#1_Open_Apache_Configuration_File\" >1. Open Apache Configuration File<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#Apache_Restrict_Access_by_IP_in_Virtual_Host\" >Apache Restrict Access by IP in Virtual Host<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#Apache_Restrict_Access_by_IP_in_htaccess\" >Apache Restrict Access by IP in .htaccess<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#2_Restrict_Access_by_IP\" >2. Restrict Access by IP<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#Restrict_Access_to_URL\" >Restrict Access to URL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#Restrict_Access_to_Folder\" >Restrict Access to Folder<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#Apache_Limit_Access_by_multiple_IP\" >Apache Limit Access by multiple IP<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#Restrict_Access_to_IP_Range\" >Restrict Access to IP Range<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#Allow_Access_from_Single_IP_address\" >Allow Access from Single IP address<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#3_Restart_Apache_web_server\" >3. Restart Apache web server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Apache_Restrict_Access_to_URL_by_IP\"><\/span>Apache Restrict Access to URL by IP<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Apache server provides Deny directive to block access and Allow directive to allow access. Depending on your requirement, you can place them in Apache configuration file, virtual host file or .htaccess file. They can be used to block or allow access to entire website, specific directories or URLs. Here are the steps to restrict access to URL by IP.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Open_Apache_Configuration_File\"><\/span>1. Open Apache Configuration File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Apache configuration file is located at one of the following locations, depending on your Linux distribution. <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>\/etc\/apache2\/httpd.conf<\/code><\/li>\n\n\n\n<li><code>\/etc\/apache2\/apache2.conf<\/code><\/li>\n\n\n\n<li><code>\/etc\/httpd\/httpd.conf<\/code><\/li>\n\n\n\n<li><code>\/etc\/httpd\/conf\/httpd.conf<\/code><\/li>\n<\/ul>\n\n\n\n<p>Open terminal and run the following command to open Apache configuration page.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo vi \/etc\/httpd\/conf\/httpd.conf<\/pre>\n\n\n\n<p>If you make changes in Apache server configuration file, it will be applicable for all websites\/domains that you run on your Apache web server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Apache_Restrict_Access_by_IP_in_Virtual_Host\"><\/span>Apache Restrict Access by IP in Virtual Host<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you are running multiple websites on Apache server, using virtual host, then open the virtual host configuration file of the website (e.g www.website.com) for which you want to deny access to IP. Let&#8217;s say your virtual host configuration file is located at <em>\/etc\/apache2\/sites-enabled\/website.conf<\/em><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo vi \/etc\/apache2\/sites-enabled\/website.conf<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Apache_Restrict_Access_by_IP_in_htaccess\"><\/span>Apache Restrict Access by IP in .htaccess<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you do not have access to Apache main configuration file or virtual host file, then you will need to open .htaccess file. Open terminal and run the following command to open it. Change file path as per your requirement.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo vi \/var\/www\/html\/.htaccess<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Restrict_Access_by_IP\"><\/span>2. Restrict Access by IP<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Apache provides <em><a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/howto\/access.html\" target=\"_blank\" rel=\"noreferrer noopener\">Deny<\/a><\/em> directive to block one or more IP addresses. Let us assume you want to limit access to <em>\/product<\/em>.html URL by IP 45.34.21.10. Once you have opened the appropriate configuration file, look for &lt;Location> tag for the above URL. <\/p>\n\n\n\n<p><strong>Please note<\/strong>, if you are using .htaccess file, you can directly place the following Deny directive in a .htaccess file in the folder. Location blocks do not work in .htaccess file.<\/p>\n\n\n\n<p>Add the following line in Location tag or .htaccess file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Deny 45.34.21.10<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Restrict_Access_to_URL\"><\/span>Restrict Access to URL<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Look for the location tag pertaining to the specific URL or create a new one and add the Deny directive in it. Your Location tag will look something like the following.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;Location \/product.html&gt;\n   ...\n   Deny 45.34.21.10\n   ...\n&lt;\/Location&gt;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Restrict_Access_to_Folder\"><\/span>Restrict Access to Folder<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you want to block IP from accessing a specific directory such as <em>\/admin<\/em>, then add the above Deny directive in location block of <em>\/admin<\/em> subfolder. This is similar to blocking access to a single URL. In this case, access to all URLs in folder is restricted.<\/p>\n\n\n\n<pre id=\"block-4d6f70ba-c6a9-4ea3-8756-924bf27379f0\" class=\"wp-block-preformatted\">&lt;Location \/admin&gt;\n   ...\n   Deny 45.34.21.10\n   ...\n&lt;\/Location&gt;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Apache_Limit_Access_by_multiple_IP\"><\/span>Apache Limit Access by multiple IP<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you want to limit access to multiple IPs, add separate Deny directives for each IP. In the following example, we limit access to IPs 45.34.21.10 and 65.34.23.12<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;Location \/product.html &gt;\n   ...\n   Deny 45.34.21.10\n   Deny 65.34.23.12\n   ...\n&lt;\/Location&gt;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Restrict_Access_to_IP_Range\"><\/span>Restrict Access to IP Range<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you want to restrict access by IP range such as 45.54.20.0-45.54.20.255 then you can do it by using <a href=\"https:\/\/www.ipaddressguide.com\/cidr\" target=\"_blank\" rel=\"noreferrer noopener\">CIDR<\/a> notation of this IP range. Here&#8217;s the configuration to restrict access from above IP range.<\/p>\n\n\n\n<pre id=\"block-e7c00924-daee-4064-ac97-b5ad0988a76f\" class=\"wp-block-preformatted\">&lt;Location \/product.html &gt;\n   ...\n   Deny 45.54.20.0\/24\n   ...\n&lt;\/Location&gt;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Allow_Access_from_Single_IP_address\"><\/span>Allow Access from Single IP address<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>On the other hand, sometimes you may want to restrict access from all IP addresses, except one or more trusted ones. This is required if you want to temporarily disable access to your site to fix some issue. In this case, add the following Deny and Allow directives.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;Location \/product.html &gt;<br>   ...<br>   Deny from all<br>   Allow 45.34.21.10<br>   Allow 65.34.23.12<br>   ...<br>&lt;\/Location&gt;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Restart_Apache_web_server\"><\/span>3. Restart Apache web server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Restart Apache web server to apply changes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># service httpd restart\nOR \n# systemctl restart httpd\nOR\n# sudo service apache2 restart<\/pre>\n\n\n\n<p>Now when a user tries to access your URL or directory from blocked IP address, they will get a &#8220;403: Access Forbidden&#8221; response.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt how to restrict access from one or more IP addresses to a single URL as well as folder. It is very useful if your site is being attacked by malicious bots and attackers. It is also required if you want to quickly  restrict site access to do some troubleshooting or maintenance. We have numerous use cases, commonly required by system administrators. As you can see, Apache is very flexible and versatile when it comes to access control. <\/p>\n\n\n\n<p>The key is to add Deny directive to Apache config file, or virtual host file or .htaccess file, whichever you can access. It is important to place the right Deny directive in the appropriate Location block. If you place the Deny directive in wrong Location block, then the wrong URLs will be blocked. Also if you do not specify the right IP address or range after Deny directive, then it will restrict access from wrong IPs.<\/p>\n\n\n\n<p><a href=\"http:\/\/ubiq.co\/\">Ubiq<\/a>&nbsp;makes it easy to visualize data in minutes, and monitor in real-time dashboards.&nbsp;<a href=\"http:\/\/ubiq.co\/accounts\/register\">Try it<\/a> today!<\/p>\n\n\n\n<p>Also read<br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-enable-http2-in-apache\/\">How to Enable HTTP2 in Apache<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-enable-apache-server-status-dashboard-page\/\">How to Enable Apache Server Status Dashboard<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-disable-http-options-methods-in-apache\/\">How to Disable HTTP Options Methods in Apache<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you may need to restrict access to URL by IP. Here is how to restrict access to URL by IP.<\/p>\n","protected":false},"author":1,"featured_media":2594,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[249],"class_list":["post-2586","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache","tag-restrict-access"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Apache Restrict Access by IP - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Sometimes you may need to restrict access to URL by IP. Here is how to restrict access to URL by IP using .htaccess.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Apache Restrict Access by IP - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Sometimes you may need to restrict access to URL by IP. Here is how to restrict access to URL by IP using .htaccess.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-07T05:29:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-19T06:25:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/apache-restrict-access-url-by-ip.png\" \/>\n\t<meta property=\"og:image:width\" content=\"840\" \/>\n\t<meta property=\"og:image:height\" content=\"356\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"Apache Restrict Access by IP\",\"datePublished\":\"2020-12-07T05:29:58+00:00\",\"dateModified\":\"2024-06-19T06:25:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/\"},\"wordCount\":861,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/apache-restrict-access-url-by-ip.png?fit=840%2C356&ssl=1\",\"keywords\":[\"restrict access\"],\"articleSection\":[\"Apache\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/\",\"name\":\"Apache Restrict Access by IP - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/apache-restrict-access-url-by-ip.png?fit=840%2C356&ssl=1\",\"datePublished\":\"2020-12-07T05:29:58+00:00\",\"dateModified\":\"2024-06-19T06:25:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Sometimes you may need to restrict access to URL by IP. Here is how to restrict access to URL by IP using .htaccess.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/apache-restrict-access-url-by-ip.png?fit=840%2C356&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/apache-restrict-access-url-by-ip.png?fit=840%2C356&ssl=1\",\"width\":840,\"height\":356,\"caption\":\"apache restrict access to url by ip\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/apache-restrict-access-to-url-by-ip\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Apache Restrict Access by IP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Apache Restrict Access by IP - Ubiq BI","description":"Sometimes you may need to restrict access to URL by IP. Here is how to restrict access to URL by IP using .htaccess.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/","og_locale":"en_US","og_type":"article","og_title":"Apache Restrict Access by IP - Ubiq BI","og_description":"Sometimes you may need to restrict access to URL by IP. Here is how to restrict access to URL by IP using .htaccess.","og_url":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2020-12-07T05:29:58+00:00","article_modified_time":"2024-06-19T06:25:05+00:00","og_image":[{"width":840,"height":356,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/apache-restrict-access-url-by-ip.png","type":"image\/png"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"Apache Restrict Access by IP","datePublished":"2020-12-07T05:29:58+00:00","dateModified":"2024-06-19T06:25:05+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/"},"wordCount":861,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/apache-restrict-access-url-by-ip.png?fit=840%2C356&ssl=1","keywords":["restrict access"],"articleSection":["Apache"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/","url":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/","name":"Apache Restrict Access by IP - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/apache-restrict-access-url-by-ip.png?fit=840%2C356&ssl=1","datePublished":"2020-12-07T05:29:58+00:00","dateModified":"2024-06-19T06:25:05+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Sometimes you may need to restrict access to URL by IP. Here is how to restrict access to URL by IP using .htaccess.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/apache-restrict-access-url-by-ip.png?fit=840%2C356&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/apache-restrict-access-url-by-ip.png?fit=840%2C356&ssl=1","width":840,"height":356,"caption":"apache restrict access to url by ip"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"Apache Restrict Access by IP"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/apache-restrict-access-url-by-ip.png?fit=840%2C356&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-FI","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/2586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=2586"}],"version-history":[{"count":15,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/2586\/revisions"}],"predecessor-version":[{"id":3437,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/2586\/revisions\/3437"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/2594"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=2586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=2586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=2586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}