diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
index 0fe56cbc65..7ed789a1ea 100644
--- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
@@ -14,6 +14,8 @@
 use Drupal\views\ResultRow;
 use Drupal\views\ViewExecutable;
 use Twig\Environment;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\Routing\RequestContext;
 
 /**
  * @defgroup views_field_handlers Views field handler plugins
@@ -111,6 +113,42 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
    */
   protected $lastRenderIndex;
 
+  /**
+   * The request context.
+   *
+   * @var \Symfony\Component\Routing\RequestContext
+   */
+  protected $context;
+
+  /**
+   * Constructs a Handler object.
+   *
+   * @param array $configuration
+   *   A configuration array containing information about the plugin instance.
+   * @param string $plugin_id
+   *   The plugin_id for the plugin instance.
+   * @param mixed $plugin_definition
+   *   The plugin implementation definition.
+   * @param \Symfony\Component\Routing\RequestContext $context
+   *   The request context.
+   */
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, RequestContext $context = NULL) {
+    parent::__construct($configuration, $plugin_id, $plugin_definition);
+    $this->context = $context;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
+    return new static(
+      $configuration,
+      $plugin_id,
+      $plugin_definition,
+      $container->get('router.request_context')
+    );
+  }
+
   /**
    * {@inheritdoc}
    */
@@ -1294,7 +1332,7 @@ public function renderText($alter) {
 
         // Make sure that paths which were run through URL generation work as
         // well.
-        $base_path = base_path();
+        $base_path = $this->context->getBaseUrl() . '/';
         // Checks whether the path starts with the base_path.
         if (strpos($more_link_path, $base_path) === 0) {
           $more_link_path = mb_substr($more_link_path, mb_strlen($base_path));
@@ -1414,10 +1452,12 @@ protected function renderAsLink($alter, $text, $tokens) {
       }
 
       // Tokens might have resolved URL's, as is the case for tokens provided by
-      // Link fields, so all internal paths will be prefixed by base_path(). For
-      // proper further handling reset this to internal:/.
-      if (strpos($path, base_path()) === 0) {
-        $path = 'internal:/' . substr($path, strlen(base_path()));
+      // Link fields, so all internal paths will be prefixed by the base url
+      // from the request context. For proper further handling reset this to
+      // internal:/.
+      $base_path = $this->context->getBaseUrl() . '/';
+      if (strpos($path, $base_path) === 0) {
+        $path = 'internal:/' . substr($path, strlen($base_path));
       }
 
       // If we have no $path and no $alter['url'], we have nothing to work with,
diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
index 8517215b57..0ec4575b48 100644
--- a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
@@ -10,6 +10,7 @@
 use Drupal\Core\GeneratedUrl;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Render\Markup;
+use Drupal\Core\Routing\RequestContext;
 use Drupal\Core\Url;
 use Drupal\Core\Utility\LinkGenerator;
 use Drupal\Core\Utility\LinkGeneratorInterface;
@@ -20,6 +21,7 @@
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
+use Symfony\Component\Routing\RequestContext as SymfonyRequestContext;
 use Symfony\Component\Routing\Route;
 
 /**
@@ -113,6 +115,13 @@ class FieldPluginBaseTest extends UnitTestCase {
    */
   protected $requestStack;
 
+  /**
+   * The request context.
+   *
+   * @var \Drupal\Core\Routing\RequestContext
+   */
+  protected $requestContext;
+
   /**
    * The mocked path processor.
    *
@@ -154,6 +163,8 @@ protected function setUp(): void {
 
     $this->requestStack = new RequestStack();
     $this->requestStack->push(new Request());
+    $this->requestContext = new RequestContext();
+    $this->requestContext->fromRequestStack($this->requestStack);
 
     $this->unroutedUrlAssembler = $this->createMock('Drupal\Core\Utility\UnroutedUrlAssemblerInterface');
     $this->linkGenerator = $this->createMock('Drupal\Core\Utility\LinkGeneratorInterface');
@@ -166,6 +177,7 @@ protected function setUp(): void {
     $container_builder->set('unrouted_url_assembler', $this->unroutedUrlAssembler);
     $container_builder->set('request_stack', $this->requestStack);
     $container_builder->set('renderer', $this->renderer);
+    $container_builder->set('router.request_context', $this->requestContext);
     \Drupal::setContainer($container_builder);
   }
 
@@ -386,6 +398,59 @@ public function providerTestRenderAsLinkWithPathAndOptions() {
     return $data;
   }
 
+  /**
+   * @param string $uri
+   *   The request URI for the request context.
+   * @param string $path
+   *   The path to be rendered
+   * @param array $alter
+   *   Options and alter.
+   * @param string $link_html
+   *   The expected rendered HTML.
+   *
+   * @dataProvider providerTestRenderAsLinkWithBaseUrl
+   * @covers ::renderAsLink
+   */
+  public function testRenderAsLinkWithBaseUrl($uri, $path, array $alter, $link_html) {
+    $server = ['SCRIPT_FILENAME' => '/var/www/foo/index.php', 'PHP_SELF' => '/foo/index.php'];
+    $request = Request::create($uri, 'GET', [], [], [], $server);
+    $request_context = new SymfonyRequestContext();
+    $request_context->fromRequest($request);
+    $alter += [
+      'make_link' => TRUE,
+      'path' => $path,
+    ];
+
+    $this->setUpUrlIntegrationServices();
+    $this->setupDisplayWithEmptyArgumentsAndFields();
+    $field = $this->setupTestField(['alter' => $alter], $request_context);
+    $field->field_alias = 'key';
+    $row = new ResultRow(['key' => 'value']);
+
+    $result = $field->advancedRender($row);
+    $this->assertEquals($link_html, (string) $result);
+  }
+
+  /**
+   * Data provider for ::testRenderAsLinkWithBaseUrl().
+   *
+   * @return array
+   *   Test data.
+   */
+  public function providerTestRenderAsLinkWithBaseUrl() {
+    $data = [];
+    // Simple path with default options.
+    $data[] = ['/foo/', '/foo/test-path', [], '<a href="/test-path">value</a>'];
+    // Simple path with default options and script filename.
+    $data[] = ['/foo/index.php/', '/foo/index.php/test-path', [], '<a href="/test-path">value</a>'];
+    // Simple path with no overlap with URI.
+    $data[] = ['/bar/', '/foo/test-path', [], '<a href="/foo/test-path">value</a>'];
+    // Add a fragment.
+    $data[] = ['/foo/', '/foo/test-path', ['fragment' => 'test'], '<a href="/test-path#test">value</a>'];
+
+    return $data;
+  }
+
   /**
    * Tests link rendering with a URL and options.
    *
@@ -647,14 +712,19 @@ public function providerTestRenderAsExternalLinkWithPathAndTokens() {
   /**
    * Sets up a test field.
    *
-   * @return \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTestField|\PHPUnit\Framework\MockObject\MockObject
+   * @param array $options
+   *   Options for the field.
+   * @param \Symfony\Component\Routing\RequestContext|null $context
+   *   Optional request context.
+   *
+   * @return \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTestField|\PHPUnit_Framework_MockObject_MockObject
    *   The test field.
    */
-  protected function setupTestField(array $options = []) {
+  protected function setupTestField(array $options = [], SymfonyRequestContext $context = NULL) {
     /** @var \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTestField $field */
     $field = $this->getMockBuilder('Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTestField')
       ->addMethods(['l'])
-      ->setConstructorArgs([$this->configuration, $this->pluginId, $this->pluginDefinition])
+      ->setConstructorArgs([$this->configuration, $this->pluginId, $this->pluginDefinition, $context])
       ->getMock();
     $field->init($this->executable, $this->display, $options);
     $field->setLinkGenerator($this->linkGenerator);
@@ -776,14 +846,3 @@ public function setLinkGenerator(LinkGeneratorInterface $link_generator) {
   }
 
 }
-
-// @todo Remove as part of https://www.drupal.org/node/2529170.
-namespace Drupal\views\Plugin\views\field;
-
-if (!function_exists('base_path')) {
-
-  function base_path() {
-    return '/';
-  }
-
-}
