diff --git a/typo3/sysext/core/Classes/Database/SoftReferenceIndex.php b/typo3/sysext/core/Classes/Database/SoftReferenceIndex.php
index a33fb4014dad6503bfe7352bd9b095248f2e9f7d..128d719c8b0eef3f50afc33f77026240658fde72 100644
--- a/typo3/sysext/core/Classes/Database/SoftReferenceIndex.php
+++ b/typo3/sysext/core/Classes/Database/SoftReferenceIndex.php
@@ -595,7 +595,7 @@ class SoftReferenceIndex
         $containsSlash = strstr($rootFileDat, '/');
         $rFD_fI = pathinfo($rootFileDat);
         $fileExtension = strtolower($rFD_fI['extension']);
-        if ($fileExtension === 'php' || $fileExtension === 'html' || $fileExtension === 'htm' || trim($rootFileDat) && !$containsSlash && (@is_file(PATH_site . $rootFileDat))) {
+        if (!$containsSlash && trim($rootFileDat) && (@is_file(PATH_site . $rootFileDat) || $fileExtension === 'php' || $fileExtension === 'html' || $fileExtension === 'htm')) {
             $isLocalFile = 1;
         } elseif ($containsSlash) {
             // Adding this so realurl directories are linked right (non-existing).
diff --git a/typo3/sysext/core/Classes/Html/RteHtmlParser.php b/typo3/sysext/core/Classes/Html/RteHtmlParser.php
index 6813e626389d13781a35535419e5028f94ea9219..99babe2b4345b28b6a54333f325d7f4d10118a86 100644
--- a/typo3/sysext/core/Classes/Html/RteHtmlParser.php
+++ b/typo3/sysext/core/Classes/Html/RteHtmlParser.php
@@ -646,7 +646,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser
                         list($rootFileDat) = explode('?', $link_param);
                         $rFD_fI = pathinfo($rootFileDat);
                         $fileExtension = strtolower($rFD_fI['extension']);
-                        if ($fileExtension === 'php' || $fileExtension === 'html' || $fileExtension === 'htm' || trim($rootFileDat) && !strstr($link_param, '/') && (@is_file((PATH_site . $rootFileDat)))) {
+                        if (strpos($link_param, '/') === false && trim($rootFileDat) && (@is_file(PATH_site . $rootFileDat) || $fileExtension === 'php' || $fileExtension === 'html' || $fileExtension === 'htm')) {
                             $href = $siteUrl . $link_param;
                         } elseif (
                             (
diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
index 541cfba84ff4f36481294e7f568246ebba8f4f37..164c189df9fd1b93625ce1133bad56f9372245f8 100644
--- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
+++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
@@ -5762,7 +5762,7 @@ class ContentObjectRenderer
             $containsSlash = strpos($rootFileDat, '/') !== false;
             $rFD_fI = pathinfo($rootFileDat);
             $fileExtension = strtolower($rFD_fI['extension']);
-            if ($fileExtension === 'php' || $fileExtension === 'html' || $fileExtension === 'htm' || trim($rootFileDat) && !$containsSlash && (@is_file((PATH_site . $rootFileDat)))) {
+            if (!$containsSlash && trim($rootFileDat) && (@is_file(PATH_site . $rootFileDat) || $fileExtension === 'php' || $fileExtension === 'html' || $fileExtension === 'htm')) {
                 $isLocalFile = 1;
             } elseif ($containsSlash) {
                 // Adding this so realurl directories are linked right (non-existing).
diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
index 9c660d9443f644ed797e4ea62855844a2ec57198..3b84ffa5e9c94a1daf5bf844be8b61f5dbfa31c9 100755
--- a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
+++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
@@ -19,9 +19,11 @@ use TYPO3\CMS\Core\Charset\CharsetConverter;
 use TYPO3\CMS\Core\Core\ApplicationContext;
 use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\TimeTracker\NullTimeTracker;
+use TYPO3\CMS\Core\TypoScript\TemplateService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\ContentObject\AbstractContentObject;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
+use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
 use TYPO3\CMS\Frontend\Tests\Unit\ContentObject\Fixtures\PageRepositoryFixture;
 
 /**
@@ -45,12 +47,12 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     protected $subject = null;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
+     * @var \PHPUnit_Framework_MockObject_MockObject|TypoScriptFrontendController|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
      */
     protected $typoScriptFrontendControllerMock = null;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\TypoScript\TemplateService
+     * @var \PHPUnit_Framework_MockObject_MockObject|TemplateService
      */
     protected $templateServiceMock = null;
 
@@ -93,10 +95,10 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
         $this->createMockedLoggerAndLogManager();
 
-        $this->templateServiceMock = $this->getMock(\TYPO3\CMS\Core\TypoScript\TemplateService::class, array('getFileName', 'linkData'));
+        $this->templateServiceMock = $this->getMock(TemplateService::class, array('getFileName', 'linkData'));
         $pageRepositoryMock = $this->getMock(PageRepositoryFixture::class, array('getRawRecord'));
 
-        $this->typoScriptFrontendControllerMock = $this->getAccessibleMock(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class, array('dummy'), array(), '', false);
+        $this->typoScriptFrontendControllerMock = $this->getAccessibleMock(TypoScriptFrontendController::class, array('dummy'), array(), '', false);
         $this->typoScriptFrontendControllerMock->tmpl = $this->templateServiceMock;
         $this->typoScriptFrontendControllerMock->config = array();
         $this->typoScriptFrontendControllerMock->page = array();
@@ -4157,6 +4159,63 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->assertEquals($expectedResult, $this->subject->stdWrap_parseFunc($value, $configuration));
     }
 
+    /**
+     * @return array
+     */
+    public function detectLinkTypeFromLinkParameterDataProvider()
+    {
+        return [
+            'Domain only' => [
+                'example.com',
+                'url'
+            ],
+            'URL without a file' => [
+                'http://example.com',
+                'url'
+            ],
+            'URL with schema and a file' => [
+                'http://example.com/index.php',
+                'url'
+            ],
+            'URL with a file but without a schema' => [
+                'example.com/index.php',
+                'url'
+            ],
+            'file' => [
+                '/index.php',
+                'file'
+            ],
+        ];
+    }
+
+    /**
+     * @test
+     * @param string $linkParameter
+     * @param string $expectedResult
+     * @dataProvider detectLinkTypeFromLinkParameterDataProvider
+     */
+    public function detectLinkTypeFromLinkParameter($linkParameter, $expectedResult)
+    {
+        /** @var TemplateService|\PHPUnit_Framework_MockObject_MockObject $templateServiceObjectMock */
+        $templateServiceObjectMock = $this->getMock(TemplateService::class, array('dummy'));
+        $templateServiceObjectMock->setup = array(
+            'lib.' => array(
+                'parseFunc.' => $this->getLibParseFunc(),
+            ),
+        );
+        /** @var TypoScriptFrontendController|\PHPUnit_Framework_MockObject_MockObject $typoScriptFrontendControllerMockObject */
+        $typoScriptFrontendControllerMockObject = $this->getMock(TypoScriptFrontendController::class, array(), array(), '', false);
+        $typoScriptFrontendControllerMockObject->config = array(
+            'config' => array(),
+            'mainScript' => 'index.php',
+        );
+        $typoScriptFrontendControllerMockObject->tmpl = $templateServiceObjectMock;
+        $GLOBALS['TSFE'] = $typoScriptFrontendControllerMockObject;
+        $this->subject->_set('typoScriptFrontendController', $typoScriptFrontendControllerMockObject);
+
+        $this->assertEquals($expectedResult, $this->subject->_call('detectLinkTypeFromLinkParameter', $linkParameter));
+    }
+
     /**
      * @return array
      */
@@ -4170,6 +4229,13 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
                 ),
                 '<a href="http://typo3.org">TYPO3</a>',
             ),
+            'Link to url without schema' => array(
+                'TYPO3',
+                array(
+                    'parameter' => 'typo3.org',
+                ),
+                '<a href="http://typo3.org">TYPO3</a>',
+            ),
             'Link to url without link text' => array(
                 '',
                 array(
@@ -4243,13 +4309,13 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function typolinkReturnsCorrectLinksForEmailsAndUrls($linkText, $configuration, $expectedResult)
     {
-        $templateServiceObjectMock = $this->getMock(\TYPO3\CMS\Core\TypoScript\TemplateService::class, array('dummy'));
+        $templateServiceObjectMock = $this->getMock(TemplateService::class, array('dummy'));
         $templateServiceObjectMock->setup = array(
             'lib.' => array(
                 'parseFunc.' => $this->getLibParseFunc(),
             ),
         );
-        $typoScriptFrontendControllerMockObject = $this->getMock(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class, array(), array(), '', false);
+        $typoScriptFrontendControllerMockObject = $this->getMock(TypoScriptFrontendController::class, array(), array(), '', false);
         $typoScriptFrontendControllerMockObject->config = array(
             'config' => array(),
             'mainScript' => 'index.php',
@@ -4467,13 +4533,13 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $pageRepositoryMockObject = $this->getMock(\TYPO3\CMS\Frontend\Page\PageRepository::class, array('getPage'));
         $pageRepositoryMockObject->expects($this->any())->method('getPage')->willReturn($pageArray);
-        $templateServiceObjectMock = $this->getMock(\TYPO3\CMS\Core\TypoScript\TemplateService::class, array('dummy'));
+        $templateServiceObjectMock = $this->getMock(TemplateService::class, array('dummy'));
         $templateServiceObjectMock->setup = array(
             'lib.' => array(
                 'parseFunc.' => $this->getLibParseFunc(),
             ),
         );
-        $typoScriptFrontendControllerMockObject = $this->getMock(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class, array(), array(), '', false);
+        $typoScriptFrontendControllerMockObject = $this->getMock(TypoScriptFrontendController::class, array(), array(), '', false);
         $typoScriptFrontendControllerMockObject->config = array(
             'config' => array(),
             'mainScript' => 'index.php',
@@ -4542,13 +4608,13 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function typolinkReturnsCorrectLinksFiles($linkText, $configuration, $expectedResult)
     {
-        $templateServiceObjectMock = $this->getMock(\TYPO3\CMS\Core\TypoScript\TemplateService::class, array('dummy'));
+        $templateServiceObjectMock = $this->getMock(TemplateService::class, array('dummy'));
         $templateServiceObjectMock->setup = array(
             'lib.' => array(
                 'parseFunc.' => $this->getLibParseFunc(),
             ),
         );
-        $typoScriptFrontendControllerMockObject = $this->getMock(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class, array(), array(), '', false);
+        $typoScriptFrontendControllerMockObject = $this->getMock(TypoScriptFrontendController::class, array(), array(), '', false);
         $typoScriptFrontendControllerMockObject->config = array(
             'config' => array(),
             'mainScript' => 'index.php',
@@ -4911,7 +4977,7 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     }
 
     /**
-     * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
+     * @return TypoScriptFrontendController
      */
     protected function getFrontendController()
     {