diff --git src/wp-includes/general-template.php src/wp-includes/general-template.php
index 4f2be9f..cef554c 100644
--- src/wp-includes/general-template.php
+++ src/wp-includes/general-template.php
@@ -2815,9 +2815,8 @@ function wp_resource_hints() {
 		 * @param string $relation_type The relation type the URLs are printed for, e.g. 'preconnect' or 'prerender'.
 		 */
 		$urls = apply_filters( 'wp_resource_hints', $urls, $relation_type );
-		$urls = array_unique( $urls );
 
-		foreach ( $urls as $url ) {
+		foreach ( $urls as $key => $url ) {
 			$url = esc_url( $url, array( 'http', 'https' ) );
 
 			if ( in_array( $relation_type, array( 'preconnect', 'dns-prefetch' ) ) ) {
@@ -2826,14 +2825,22 @@ function wp_resource_hints() {
 					continue;
 				}
 
-				if ( ! empty( $parsed['scheme'] ) ) {
+				if ( 'dns-prefetch' === $relation_type ) {
+					$url = '//' . $parsed['host'];
+				} else if ( ! empty( $parsed['scheme'] ) ) {
 					$url = $parsed['scheme'] . '://' . $parsed['host'];
 				} else {
 					$url = $parsed['host'];
 				}
 			}
 
-			printf( "<link rel='%s' href='%s'>\r\n", $relation_type, $url );
+			$urls[ $key ] = $url;
+		}
+
+		$urls = array_unique( $urls );
+
+		foreach ( $urls as $url ) {
+			printf( "<link rel='%s' href='%s'>\n", $relation_type, $url );
 		}
 	}
 }
diff --git tests/phpunit/tests/general/resourceHints.php tests/phpunit/tests/general/resourceHints.php
index 351e6df..f75e199 100644
--- tests/phpunit/tests/general/resourceHints.php
+++ tests/phpunit/tests/general/resourceHints.php
@@ -31,7 +31,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
 	}
 
 	function test_should_have_defaults_on_frontend() {
-		$expected = "<link rel='preconnect' href='http://s.w.org'>\r\n";
+		$expected = "<link rel='preconnect' href='http://s.w.org'>\n";
 
 		$this->expectOutputString( $expected );
 
@@ -39,10 +39,10 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
 	}
 
 	function test_dns_prefetching() {
-		$expected = "<link rel='dns-prefetch' href='http://wordpress.org'>\r\n" .
-					"<link rel='dns-prefetch' href='https://google.com'>\r\n" .
-					"<link rel='dns-prefetch' href='make.wordpress.org'>\r\n" .
-					"<link rel='preconnect' href='http://s.w.org'>\r\n";
+		$expected = "<link rel='dns-prefetch' href='//wordpress.org'>\n" .
+					"<link rel='dns-prefetch' href='//google.com'>\n" .
+					"<link rel='dns-prefetch' href='//make.wordpress.org'>\n" .
+					"<link rel='preconnect' href='http://s.w.org'>\n";
 
 		add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_domains' ), 10, 2 );
 
@@ -56,18 +56,20 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
 	function _add_dns_prefetch_domains( $hints, $method ) {
 		if ( 'dns-prefetch' === $method ) {
 			$hints[] = 'http://wordpress.org';
+			$hints[] = 'https://wordpress.org';
 			$hints[] = 'https://google.com';
 			$hints[] = '//make.wordpress.org';
+			$hints[] = 'https://wordpress.org/plugins/';
 		}
 
 		return $hints;
 	}
 
 	function test_prerender() {
-		$expected = "<link rel='preconnect' href='http://s.w.org'>\r\n" .
-					"<link rel='prerender' href='https://make.wordpress.org/great-again'>\r\n" .
-					"<link rel='prerender' href='http://jobs.wordpress.net'>\r\n" .
-					"<link rel='prerender' href='//core.trac.wordpress.org'>\r\n";
+		$expected = "<link rel='preconnect' href='http://s.w.org'>\n" .
+					"<link rel='prerender' href='https://make.wordpress.org/great-again'>\n" .
+					"<link rel='prerender' href='http://jobs.wordpress.net'>\n" .
+					"<link rel='prerender' href='//core.trac.wordpress.org'>\n";
 
 		add_filter( 'wp_resource_hints', array( $this, '_add_prerender_urls' ), 10, 2 );
 
@@ -89,8 +91,8 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
 	}
 
 	function test_parse_url_dns_prefetch() {
-		$expected = "<link rel='dns-prefetch' href='http://make.wordpress.org'>\r\n" .
-					"<link rel='preconnect' href='http://s.w.org'>\r\n";
+		$expected = "<link rel='dns-prefetch' href='//make.wordpress.org'>\n" .
+					"<link rel='preconnect' href='http://s.w.org'>\n";
 
 		add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_long_urls' ), 10, 2 );
 
@@ -110,8 +112,8 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
 	}
 
 	function test_dns_prefetch_styles() {
-		$expected = "<link rel='dns-prefetch' href='http://fonts.googleapis.com'>\r\n" .
-					"<link rel='preconnect' href='http://s.w.org'>\r\n";
+		$expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com'>\n" .
+					"<link rel='preconnect' href='http://s.w.org'>\n";
 
 		$args = array(
 			'family' => 'Open+Sans:400',
@@ -129,8 +131,8 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
 	}
 
 	function test_dns_prefetch_scripts() {
-		$expected = "<link rel='dns-prefetch' href='http://fonts.googleapis.com'>\r\n" .
-					"<link rel='preconnect' href='http://s.w.org'>\r\n";
+		$expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com'>\n" .
+					"<link rel='preconnect' href='http://s.w.org'>\n";
 
 		$args = array(
 			'family' => 'Open+Sans:400',
