diff --git a/.htaccess b/.htaccess
index 0ad7be304817441f91df826d91123e4359e039ff..5248bd85d61936b9f090993f396af1c31acbd3b5 100644
--- a/.htaccess
+++ b/.htaccess
@@ -3,7 +3,7 @@
 #
 
 # Protect files and directories from prying eyes.
-<FilesMatch "\.(engine|inc|info\.yml|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
+<FilesMatch "\.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
   <IfModule mod_authz_core.c>
     Require all denied
   </IfModule>
diff --git a/core/modules/system/src/Tests/System/HtaccessTest.php b/core/modules/system/src/Tests/System/HtaccessTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..29f133d93906a929664dc5ccee2d96cbf5b76a2d
--- /dev/null
+++ b/core/modules/system/src/Tests/System/HtaccessTest.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\system\Tests\System\HtaccessTest
+ */
+
+namespace Drupal\system\Tests\System;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests access restrictions provided by the default .htaccess file.
+ *
+ * @group system
+ */
+class HtaccessTest extends WebTestBase {
+
+  /**
+   * Tests accessing files with .yml extensions at various locations.
+   */
+  public function testYamlFileAccess() {
+    // Try accessing the core services YAML file.
+    $this->assertNoFileAccess('core/core.services.yml');
+    // Try accessing a core module YAML file.
+    $this->assertNoFileAccess('core/modules/system/system.services.yml');
+  }
+
+  /**
+   * Asserts that a file exists but not accessible via HTTP.
+   *
+   * @param $path
+   *   Path to file. Without leading slash.
+   */
+  protected function assertNoFileAccess($path) {
+    $this->assertTrue(file_exists(DRUPAL_ROOT . '/' . $path));
+    $this->drupalGet($path);
+    $this->assertResponse(403);
+  }
+
+}
diff --git a/web.config b/web.config
index b71c37cdcb7ac5f48551cca1bf40c2a3f26ac764..b072d9b02db28b0f4918adb5126166320b65c7a3 100644
--- a/web.config
+++ b/web.config
@@ -22,7 +22,7 @@
     <rewrite>
       <rules>
         <rule name="Protect files and directories from prying eyes" stopProcessing="true">
-          <match url="\.(engine|inc|info\.yml|install|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$" />
+          <match url="\.(engine|inc|install|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$" />
           <action type="CustomResponse" statusCode="403" subStatusCode="0" statusReason="Forbidden" statusDescription="Access is forbidden." />
         </rule>