How to remove physical path from BE links

Topics: ASP.NET 2.0, Business Logic Layer
Nov 26, 2009 at 10:18 PM


I installed BE (latest 1.5 release, haven't tried beta builds)  in some nested folder in my GoDaddy shared account. Say, if my domain name is "", then path looks like that: "\root\domains\".

When I am trying to access my blog, path in most links looks weird like this:

I want to remove bolded part of the address and receive all links in such form:

How can I do this? In general, I think that it is some design error because it's not a good idea to show physical path on the server to site visitors.

Thank you in advance for your help!

Nov 27, 2009 at 9:24 AM

Others at GoDaddy have had similar issues when you either use subdomains or when you map domain names to sub-folders.  Here's a related topic:

If you have a basic hosting plan at GoDaddy without multiple domains, subdomains etc, that extra content in the URLs should not appear.

Dec 11, 2009 at 2:16 PM

Thank you for answer, BenAmada.

It seems that I am struggling from same symptoms that described on thread you've pointed.

I am using ModifyLinks extension from that thread and it work reasonably well except "Archive" section - I do not know why but this extensions is rewriting all links except that ones that are on "Archive" page.

Maybe that page is delivered differently, because ModifyLinks attaches itself in this way:

BlogEngine.Core.Post.Serving += new EventHandler(Post_Serving);
BlogEngine.Core.Page.Serving += new EventHandler(Post_Serving);

How can I attach it to Archive page?

Dec 11, 2009 at 5:01 PM

I'm not familiar with that particular extension.  But there's not a way for an Extension to tap into the Archive page.

You could modify archive.aspx.cs yourself, however.  There's this line of code in it:

title.InnerHtml = string.Format("<a href=\"{0}\">{1}</a>", post.RelativeLink, post.Title);

The link is coming from "post.RelativeLink".  If you're trying to remove a folder name from the link, you can change it to something like:

title.InnerHtml = string.Format("<a href=\"{0}\">{1}</a>", post.RelativeLink.Replace("/domains/", ""), post.Title);

This would remove "/domains/" from the links outputted onto the Archive page.

Dec 12, 2009 at 7:13 PM

Thank you, BenAmada for your help.

I tried your advice, some links become corrected but some still not (and on other pages like "Contact"). Navigation looks messy and is not SEO friendly because different links points to same content. Complete solution requires more modifications in source code of blog engine but this way is not good for any future updates.

Eventually I decided to re-organize folder naming in my hosting account and replace "domains/" with short acronym which takes some space in links but is not confusing for site visitors. One significant drawback of such approach is that it complicates hosting accoun support with multiple domains attached to it. But I think that I can live with it.

Finally, I think that it is a good idea to implement such functionality like "link modification" inside core code of BE or at least provide opportunity for extensions to do this job.