Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to alter the prefixes EPiServer is adding to src attributes in html
    primarykey
    data
    text
    <p>I have a fragment of html which is contained in a property of a templated EPiServer page, within that html there is an <code>img</code> tag which has a relative url in it.</p> <p>When the page is viewed, I can see the src attribute of the tag has been altered to have the prefix <code>/ProjectName/Templates/Pages/</code>.</p> <p>I understand that this is being done by <code>HtmlRewriteToExternal</code> so that image files that are stored alongside the aspx template (which does indeed live in <code>Templates\Pages</code>) are located correctly, however the image which is intended to be part of the html fragment is in my case actually stored under <code>PageFiles/nnn/</code> (where nnn is actually the parent page's <code>PageFolderID</code>), and I need to somehow make the altered html reflect that.</p> <p>I've created a class that inherits from <code>FriendlyUrlRewriteProvider</code> and registered my class. I can debug the application, and watch the requests go through the overridden methods, but I still can't see where the prefix is being added or get any idea how to change it. I can alter the src tag to a different relative path in my class, but the prefix is still being added.</p> <p>I've read everything I can find on the EPiServer url rewriting, but can't find anything that hints as to where this prefix is being added or how to stop that or change it.</p> <p>Things I've read:</p> <ul> <li><a href="http://blogs.interakting.co.uk/post/File-Extensions-and-URL-Rewriting-in-EPiServer.aspx" rel="nofollow">http://blogs.interakting.co.uk/post/File-Extensions-and-URL-Rewriting-in-EPiServer.aspx</a></li> <li><a href="http://blog.fredrikhaglund.se/blog/2008/05/07/disable-episerver-urlrewriter-interference/" rel="nofollow">http://blog.fredrikhaglund.se/blog/2008/05/07/disable-episerver-urlrewriter-interference/</a> (this may contain the answer I'm looking for)</li> <li><a href="http://labs.kaliko.com/2010/11/prevent-episerver-urlrewrite.html" rel="nofollow">http://labs.kaliko.com/2010/11/prevent-episerver-urlrewrite.html</a></li> <li><a href="http://sourcecodebean.com/archives/episerver-friendly-urls-for-paginated-pages-and-why-the-asplinkbutton-must-die/510" rel="nofollow">http://sourcecodebean.com/archives/episerver-friendly-urls-for-paginated-pages-and-why-the-asplinkbutton-must-die/510</a></li> <li><a href="http://tedgustaf.com/en/blog/2008/7/create-a-custom-url-rewrite-provider-for-episerver/" rel="nofollow">http://tedgustaf.com/en/blog/2008/7/create-a-custom-url-rewrite-provider-for-episerver/</a></li> <li><a href="http://tedgustaf.com/en/blog/2011/4/publishing-plain-html-pages-in-episerver/" rel="nofollow">http://tedgustaf.com/en/blog/2011/4/publishing-plain-html-pages-in-episerver/</a></li> <li><a href="http://sdk.episerver.com/library/cms5/Developers%20Guide/Friendly%20URL.htm" rel="nofollow">http://sdk.episerver.com/library/cms5/Developers%20Guide/Friendly%20URL.htm</a></li> <li><a href="http://sdk.episerver.com/library/cms6.1/html/T_EPiServer_Web_UrlRewriteModule.htm" rel="nofollow">http://sdk.episerver.com/library/cms6.1/html/T_EPiServer_Web_UrlRewriteModule.htm</a></li> <li><a href="http://labs.episerver.com/en/Blogs/Ruwen/Dates/111218/112064/112154/" rel="nofollow">http://labs.episerver.com/en/Blogs/Ruwen/Dates/111218/112064/112154/</a></li> <li><a href="http://world.episerver.com/Blogs/Magnus-Strale/Dates/2011/3/Do-we-really-need-yet-another-HTML-parser/" rel="nofollow">http://world.episerver.com/Blogs/Magnus-Strale/Dates/2011/3/Do-we-really-need-yet-another-HTML-parser/</a></li> <li><a href="http://world.episerver.com/Blogs/Yugeen-Klimenko/Dates/2011/6/How-EPiServer-URL-Rewriting-works/" rel="nofollow">http://world.episerver.com/Blogs/Yugeen-Klimenko/Dates/2011/6/How-EPiServer-URL-Rewriting-works/</a></li> <li><a href="http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=46869" rel="nofollow">http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=46869</a></li> </ul> <hr> <p>I'm open to completely different solutions for what I'm actually trying to achieve, which is as follows:</p> <p>I have multiple independent sets of static html files and related image / css / js files, which I'm trying to store / publish with EPiServer. The structure of each set looks something like</p> <ul> <li>setfolder/ <ul> <li>htmlfileA.html</li> <li>htmlfileB.html</li> <li>css/ <ul> <li>styles.css</li> </ul></li> <li>images/ <ul> <li>piccy1.png</li> <li>piccy2.png</li> </ul></li> <li>js/ <ul> <li>magic.js</li> </ul></li> </ul></li> </ul> <p>I've figured that I should create an EPiServer page for the set, and then child pages for each html file, storing the html from the files in a property of the child pages. Currently I'm storing the related static files in the PageFiles of the relevant setfolder page, as that seems to be the most logically consistent place to put them.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload