<p>If I have a rich text field containing a link to an asset and I create the link on my development server <code>sample.craft.dev</code>, the html in the rich text field contains this:</p>

<pre><code>&lt;a href="http://sample.craft.dev/uploads/pdfs/file.pdf#asset:945:url"&gt;the file&lt;/a&gt;
</code></pre>

<p>If I then move the database to my staging server <code>stage.sample.com</code>, the html in the rich text field now magically contains the new url:</p>

<pre><code>&lt;a href="http://stage.sample.com/uploads/pdfs/file.pdf#asset:945:url"&gt;the file&lt;/a&gt;
</code></pre>

<p>How does that happen?</p>

<p>If the html in the rich text field on the development server instead contains this:</p>

<pre><code>&lt;select class="jumpMenu js_jumpMenu"&gt;
  &lt;option value=""&gt;-- select brochure --&lt;/option&gt;
  &lt;option value="http://stage.sample.com/uploads/pdfs/file.pdf#asset:969:url"&gt;The File&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>Then the url is not rewritten. Why is that?</p>

CC BY-SA 3.0
2014-12-21T18:15:50.453Z
I assume you're manually entering the `#asset:969:url` in the 2nd example?
Brad Bell
CC BY-SA 3.0
2014-12-21T19:37:08.910Z
Yes, entering it manually.
Marion Newlevant
CC BY-SA 3.0
2014-12-21T22:19:00.857Z
Not an answer, but take a look at RichTextInput.js. There is some magic going on in there specifically when linking to an asset or inserting an image.
Brad Bell
<richtext><multi-environment>
How do asset and entry urls in rich text fields change with the environment?
# How do asset and entry urls in rich text fields change with the environment?

(Asked by: username_0 on 2014-12-21)

If I have a rich text field containing a link to an asset and I create the link on my development server sample.craft.dev, the html in the rich text field contains this:
the file

If I then move the database to my staging server stage.sample.com, the html in the rich text field now magically contains the new url:
the file

How does that happen?
If the html in the rich text field on the development server instead contains this:

  -- select brochure --
  The File


Then the url is not rewritten. Why is that?

**Tags:** richtext, multi-environment
> **Comments:**
> **username_1**: I assume you're manually entering the `#asset:969:url` in the 2nd example?  
> **username_0**: Yes, entering it manually.  
> **username_1**: Not an answer, but take a look at RichTextInput.js. There is some magic going on in there specifically when linking to an asset or inserting an image.  

---

## 0 answers

