DotNetNuke Powered!
          
John Mitchell's (mostly DotNetNuke) Blog - Use SiteUrls.config to clean up the DotNetNuke Child Portal Url
 Tuesday, October 11, 2005

Tired of having that ugly qureystring for the home page of your child portals?  DotNetNuke child portals have their own folder under the main website so they can be referenced as a sub-folder, or "child" of the main portal.

To make this work with the rest of the portals, there is code in the default.aspx page that creates an alias parameter that looks something like this: 

alias=www.myhost.com/myportal

This child default page then redirects to the main default.aspx page with that querystring variable, so you end up getting a Url that repeats the hostdomain something like this:

http://www.myhost.com/default.aspx?alias=www.myhost.com/myportal

With the SiteUrls.config file you can have DNN rewrite this Url so that the result looks like you browsed to the child folder without any querystring variable at all.

First, figure out what the tabid is for the home page for the child portal, on mine it was tabid=508, then add a rule to SiteUrls.config like this:

  <RewriterRule>
   <LookFor>.*/child1/default.aspx</LookFor>
   <SendTo>~/Default.aspx?TabId=508</SendTo>
  </RewriterRule>

Where child1 is the name of your child portal.

You have to leave the child folder and the default page there, because IIS needs to find that before it will call up the web app, otherwise you'll get a 404 page not found.

This keeps your Url nice and clean and you even save the redirect.

You could also make a rule like this and get the same result without having to know the tabid:

  <RewriterRule>
   <LookFor>.*/child1/default.aspx</LookFor>
   <SendTo>~/Default.aspx?alias=www.snapsis.com/child1</SendTo>
  </RewriterRule>

This is a nice way to clean up the Url for a few child portals, but I wouldn't recommend running it on too many, because every rule that you add to the SiteUrls.config file adds to the overhead of every request no matter what portal you are accessing.

A more efficent way, although not quite as elegant is to just change the child's default.aspx page code so that it redirects directly to the tabid or portalid of the child portal as mentioned in this ASP.Net forums thread.

10/11/2005 11:29:26 PM (Central Standard Time, UTC-06:00)  #    Comments [2]
10/13/2006 7:20:47 PM (Central Standard Time, UTC-06:00)
if your host account supoorts subdomains, that is an option too... Ex.:
http://child1.myhost.com

(just add that as a portal alias)
10/11/2007 1:16:33 PM (Central Standard Time, UTC-06:00)
Why can't I browse/edit to my child portal from the parent?
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):