Answers.Body: <p>I solved this by creating a <a href="https://github.com/craftcms/redactor#redactor-js-plugins" rel="nofollow noreferrer">Redactor plugin</a> that listens for the <a href="https://imperavi.com/redactor/docs/callbacks/link/" rel="nofollow noreferrer"><code>link.inserted</code></a> event and strips out the site identifer:</p>
  
  <p><code>craft/config/redactor/plugins/myplugin.js</code>:</p>
  
  <pre><code>(function($R)
  {
      $R.add('plugin', 'myplugin', {
          onlink: {
              inserted: function(link) { 
                  link.nodes.forEach(node =&gt; node.href = node.href.replace(/@\d+/, ''))
               },
          },
      });
  })(Redactor);
  </code></pre>
  
  <p><code>craft/config/redactor/redactorFieldConfig.json</code>:</p>
  
  <pre><code>{
      "plugins": ["myplugin"]
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-09T23:13:16.570Z
Answers.LastActivityDate: 2020-06-09T23:13:16.570Z
Answers.UserDisplayName: Garrett
Body: <p>I have a multi-site setup, and when using Redactor's <strong>Link to an entry</strong> function, by default, site identifiers are added to the link href:</p>
  
  <p><code>href="https://mysite/my-page#entry:4223@3:url"</code></p>
  
  <p>I would like to prevent (or strip out) the <code>@3</code> site identifier, because I wish to use the current site's base URL, rather than specify a specific site's base URL be used. Is this possible?</p>
  
Tags: <redactor><reference-tags>
Title: Prevent Redactor from adding site identifier to entry links
ThreadText: # Prevent Redactor from adding site identifier to entry links
  
  (Asked by: username_0 on 2020-06-09)
  
  I have a multi-site setup, and when using Redactor's **Link to an entry** function, by default, site identifiers are added to the link href:
  
  `href="https://mysite/my-page#entry:4223@3:url"`
  
  I would like to prevent (or strip out) the `@3` site identifier, because I wish to use the current site's base URL, rather than specify a specific site's base URL be used. Is this possible?
  
  **Tags:** redactor, reference-tags
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-06-09. Score: 1 | Accepted answer
  
  I solved this by creating a [Redactor plugin](https://github.com/craftcms/redactor#redactor-js-plugins) that listens for the [`link.inserted`](https://imperavi.com/redactor/docs/callbacks/link/) event and strips out the site identifer:
  
  `craft/config/redactor/plugins/myplugin.js`:
  
  ```
  (function($R)
  {
      $R.add('plugin', 'myplugin', {
          onlink: {
              inserted: function(link) { 
                  link.nodes.forEach(node => node.href = node.href.replace(/@\d+/, ''))
               },
          },
      });
  })(Redactor);
  
  ```
  
  `craft/config/redactor/redactorFieldConfig.json`:
  
  ```
  {
      "plugins": ["myplugin"]
  }
  
  ```
  
  
  ---
  
  