Absolute paths get rewritten as relative paths

Rob
Rob
Vote:
 

Has anyone else noticed that in EPiServer 5 CMS SP1 if you have absolute paths defined anywhere in your application (be it in a user control for the stylesheets in the header, or in a property of an EPiServer page) then the absolute path gets rewritten to be relative?

For example, what would be coded as:

/assets/styles/screen.css

Becomes this at one level deep:

../assets/styles/screen.css

 

Personally this isn't functionality that is beneficial and is causing problems in some circumstances, such as using an EPiServer page as a 404 page (it gets the paths incorrect).

I've raised this as a bug but alas it's strayed off into 404 territory and the core issue is not being dealt with.

#19855
May 08, 2008 16:47
Vote:
 

Hello Rob,

The UrlRewriter have been discussed some before on the forum (post).

But a quick summary:

There is a static property on the FriendlyUrlRewriteProvider called UnTouchedPaths. You can enter paths to that collection and they will be ignored by the url rewriter.

Should you need to mark a specific aspx to be ignored then have a look at Fredrik Haglund's blog post on how to prevent paths to be rewritten by EPiServer CMS 5.

/Petter

#19908
May 14, 2008 11:27
Vote:
 

Petter, you where faster to refer to my blog than myself. Laughing

I had a similar situation in one of my projects where FURL was not the culprit. I had the following code in my masterpage:

<a runat="server" href="#content" accesskey="s" title="Skip navigation">

And it generates this output:

<a href="Templates/Public/MasterPages/#content" accesskey="s" title="Skip navigation">

Note, that the path to the masterpage is added by the fact that you convert it to a html control with runat="server" and removing that would leave it correct.

There problem above is probably related to the fact that all URL processed by FriendlyHtmlRewriteToExternal is run through EPiServer.UrlBuilder.Rebase with RebaseKind set to default. I second Rob and would also prefer if EPiServer could leave URLs not related to EPiServer pages and files untouched.

The only workaround I can think of is to create your own sub class of FriendlyUrlRewriteProvider and override GetHtmlRewriter() and add an event handler for HtmlRewritingUrl that cancels rewrite of absolute urls.

#19911
May 14, 2008 12:29
Rob
Vote:
 

Would cancelling rewrite of all absolute URLs solve the problem? I'm pretty sure that when you create links to internal pages with the "DHTML" editor, they reference the template aspx path with the page ID appended as a query string.

Those URLs would still need to be handled by the URL rewriter.

I think it's more a case of rewriting URLs to be absolute, rather than rewriting them to be relative, and I wouldn't have thought that the functionality actually needs to be much different to achieve this, nor would there be any negative effects.

#19928
May 14, 2008 17:05
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.