I need to make all links in a particular path tree relative, we figured we could do this by using URL rewrite, however it would be good to be able to find the subdomain's path regardless of what is is to enact this rewrite and I am unsure of how to about it.
so if the link of a href is alt.domain.com/biscuits/donkey it gets rewritten as /biscuits/donkey.
that way if subd is using the menu from alt, then the links to any non-local tree node are changed to be local and relative. ie: a link on a page under subd = "alt.domain.com/biscuits/donkey" gets changed to "/biscuits/donkey"
Unsure if I would need to make a plugin or if this should be simple from elsewhere, but I want to do it in codebehind so I can find the asbolute URL of alt.domain.com from the node, so that if a change is made, everything keeps working properly. This also means not having a magicstring in the web.config rewriting from there.
We used razor to hit a string extension for all the components requiring changing, this extension finds out if the particular URL used in a link is relevant, then strips out the website address, making it relative.
the IContentFinder in this instance is not really appropriate and adds unnecessary complication, thanks for the suggestion though.
codebehind is a term used in Xamarin, generic .NET and other frameworks still.
How to rewrite URL in codebehind
I need to make all links in a particular path tree relative, we figured we could do this by using URL rewrite, however it would be good to be able to find the subdomain's path regardless of what is is to enact this rewrite and I am unsure of how to about it.
so if the link of a href is alt.domain.com/biscuits/donkey it gets rewritten as /biscuits/donkey.
that way if subd is using the menu from alt, then the links to any non-local tree node are changed to be local and relative. ie: a link on a page under subd = "alt.domain.com/biscuits/donkey" gets changed to "/biscuits/donkey"
Unsure if I would need to make a plugin or if this should be simple from elsewhere, but I want to do it in codebehind so I can find the asbolute URL of alt.domain.com from the node, so that if a change is made, everything keeps working properly. This also means not having a magicstring in the web.config rewriting from there.
hi,
I would suggest you just remove the domain when rendering the urls.
It would likely need some kind of content finder since you either need to add all the domains to the parent / root, if you need the content to be routable on those other urls. Have a look at the documentation her https://our.umbraco.com/documentation/Reference/Routing/Request-Pipeline/IContentFinder
HTH :)
also, codebehind was a term used in asp.net forms - not used in asp.net mvc :)
We used razor to hit a string extension for all the components requiring changing, this extension finds out if the particular URL used in a link is relevant, then strips out the website address, making it relative.
the IContentFinder in this instance is not really appropriate and adds unnecessary complication, thanks for the suggestion though.
codebehind is a term used in Xamarin, generic .NET and other frameworks still.
is working on a reply...