Page view counter

How can you avoid displaying the portal alias in query string when accessing child portal?

Last post 10-12-2005 9:10 PM by ikamiksok. 13 replies.

Sort Posts:

  • How can you avoid displaying the portal alias in query string when accessing child portal?

    07-01-2005, 5:14 PM
    • Loading...
    • ikamiksok
    • Joined on 11-12-2003, 12:08 PM
    • Posts 247
    • Points 1,235
    When I access my main site, it loads with a standard url:
    www mysite com

    When I access my child site, it does the following:
    www mysite com/child1/default.aspx?alias=www mysite com/child1

    When I do searches on my site, search engines all return this url which looks bad. I am assuming this is needed upon first load so that DNN knows which portal alias to use and portal to load.

    Is there a way to avoid this? I was thinking that you could use the URL rewriter. Would the SiteUrls.config work (http://forums.asp.net/888126/ShowPost.aspx)? Could I add rules such as: replace "?alias=www mysite com/child1" with ""

    Thanks,
    Jason
  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    07-07-2005, 3:43 PM
    • Loading...
    • ikamiksok
    • Joined on 11-12-2003, 12:08 PM
    • Posts 247
    • Points 1,235
    Anyone? I have not found a solution to this yet. Is this possible to fix?
  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    07-07-2005, 4:10 PM
    • Loading...
    • J7Mitch
    • Joined on 10-19-2002, 1:23 PM
    • Posts 2,632
    • Points 13,145
    • TrustedFriends-MVPs
    One way is to make it a parent portal instead of a child.

    Instead of www.myportal.com/child   you could point another host at your website with DNS called   child1
    Then add child1.myportal.com as an alais for that portal.
    John M.

    DotNetNuke Module for Performance
  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    07-07-2005, 4:29 PM
    • Loading...
    • brian_c
    • Joined on 01-22-2004, 6:31 PM
    • Frisco, TX
    • Posts 2,259
    • Points 11,292
    are you getting that url when you first click on a child portal from your portal listing ...??

    how would search engines get that?   or is this dnn2.x?

  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    07-07-2005, 5:29 PM
    • Loading...
    • J7Mitch
    • Joined on 10-19-2002, 1:23 PM
    • Posts 2,632
    • Points 13,145
    • TrustedFriends-MVPs
    Also, if you know the tab or portalid for the home page you could change the default.aspx page in the childs folder to use that to identify the child portal instead of alias on the querystring.
    John M.

    DotNetNuke Module for Performance
  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    07-12-2005, 1:03 PM
    • Loading...
    • ikamiksok
    • Joined on 11-12-2003, 12:08 PM
    • Posts 247
    • Points 1,235
    OK. Thanks. I was able to look into this further and understand how it works. Unfortunately, no easy fix that I could find I don't think. To confirm, my search engines do all display my child page links as parent.com/child1/default.aspx?alias=parent/com/child1. As they display the final URL string that the page finally redirects itself to to rather than the URL that points to the page.

    I suppose I could wait for a friendly URL module to be released that support seo & human friendly URLs. Then maybe parent.com/child1/home.aspx would work. But I am unsure of how it would handle different portals.

    One thing I was thinking about was if the portalalias could be stored in a session variable rather than passed in as a query string?

    Jason
  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    10-05-2005, 3:15 PM
    • Loading...
    • ikamiksok
    • Joined on 11-12-2003, 12:08 PM
    • Posts 247
    • Points 1,235
     J7Mitch wrote:
    Also, if you know the tab or portalid for the home page you could change the default.aspx page in the childs folder to use that to identify the child portal instead of alias on the querystring.


    OK. I am ready to look into this again and was wondering what I could actually do here to each default.aspx page to get this to work? Assuming that I do know the portalID for that default.aspx file for the child portal alias.

    I did also read somewhere I thought that it used to not add the portal alias to the query string at the end in prior DNN versions but they readded it as a fix for a viewstate problem.

    Jason
  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    10-05-2005, 4:26 PM
    • Loading...
    • J7Mitch
    • Joined on 10-19-2002, 1:23 PM
    • Posts 2,632
    • Points 13,145
    • TrustedFriends-MVPs

    in the child's default.aspx page change

    DomainName = ServerPath & "Default.aspx?alias=" & DomainName

    To
    DomainName = ServerPath & "Default.aspx?portalId=nn"  ( where nn = your child's portalid)

    you can also remove the code that pulls the alias off of the url
                ' parse the Request URL into a Domain Name token
                URL = Split(Request.Url.ToString(), "/")
                For intURL = 2 To URL.GetUpperBound(0)
                    Select Case URL(intURL).ToLower
                        Case "admin", "desktopmodules", "mobilemodules", "premiummodules"
                            Exit For
                        Case Else
                            ' check if filename
                            If InStr(1, URL(intURL), ".aspx") = 0 Then
                                DomainName = DomainName & IIf(DomainName <> "", "/", "") & URL(intURL)
                            Else
           Exit For
                            End If
                    End Select
                Next intURL

    John M.

    DotNetNuke Module for Performance
  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    10-11-2005, 2:22 AM
    • Loading...
    • ikamiksok
    • Joined on 11-12-2003, 12:08 PM
    • Posts 247
    • Points 1,235

    OK. Thanks for everyone's advice so far. After further investigation, I finally found a solution that works and does not append anything to the end. Does this sound ok....

    I simply copied the default.aspx in DNN root to my portal subdirectory. This works and loads my portal. However, it loads it without the js files so it has javascript errors. This is because it is looking for them in domainname/child/js instead of domainname/js.

    So I copied the js directory over as well to my child directory and it loads error free. I think I may look for a solution to hardcode my js directory or somehow get my child portal to know to look at domainname/js.

    Am I missing anything else here other than the js problem? This seems like a rather simple hack fix.

    Jason

  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    10-11-2005, 10:39 AM
    • Loading...
    • J7Mitch
    • Joined on 10-19-2002, 1:23 PM
    • Posts 2,632
    • Points 13,145
    • TrustedFriends-MVPs
    I would be leery of running from the default.aspx from the child folder because the whole system expects the root of the application to be where the main Default.aspx page is.
    You might find obscure bugs crop up at other times, and some modules may not work as expected, plus you will have to copy all of the /js files for every child portal you create.

    If getting the child home page to show up without having anything in the querystring is the goal, I bet it could be done with the SiteUrls.config file.

    What you would do is add a rule to the file that would look for your child folder on the Url, and make it rewrite it to include the home page tabid for that child.

    Come to think of it, this may be something we could implement in the core so that child portals could be accessed without having to have the child folder and the default page that just does a redirect.  I'll look into this.

    John M.

    DotNetNuke Module for Performance
  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    10-11-2005, 2:08 PM
    • Loading...
    • ikamiksok
    • Joined on 11-12-2003, 12:08 PM
    • Posts 247
    • Points 1,235
     J7Mitch wrote:

    Come to think of it, this may be something we could implement in the core so that child portals could be accessed without having to have the child folder and the default page that just does a redirect.  I'll look into this.


    I tried the siteurls without any luck. But I am not good at regex and may not have been doing it correctly. I can give it a shot again. I suppose the idea would be in siteurls to replace
    domain/childname/default.aspx?alias=domain/childname with domain/childname/

    I like the idea of using siteurls instead of the child folders if that was possible.

    I keep bringing this up because not only can it be an annoyance for those who have child portals but it probably hurts SEO to have url redirects on your main child page. Hopefully, a good solution can be found and added to the core in the future. I am patient.

    Thanks for the response.

    Jason
  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    10-12-2005, 12:19 AM
    • Loading...
    • J7Mitch
    • Joined on 10-19-2002, 1:23 PM
    • Posts 2,632
    • Points 13,145
    • TrustedFriends-MVPs
    Ok, here is a way to make it work with SiteUrls.config without making any core changes.

    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.
    John M.

    DotNetNuke Module for Performance
  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    10-12-2005, 12:28 AM
    • Loading...
    • J7Mitch
    • Joined on 10-19-2002, 1:23 PM
    • Posts 2,632
    • Points 13,145
    • TrustedFriends-MVPs
    BTW, you could also make a rule like this and get the same result:

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


    I wouldn't recommend this approach for lots of child portals, because you are adding overhead to every request (in every portal) for every rewrite rule that you add.

    If you have several and can handle the re-direct with a tabid, then a better approach is to just make your child portal default page redirect to that tabid and take all the other processing out of the child's default.aspx page like I mentioned earlier.
    John M.

    DotNetNuke Module for Performance
  • Re: How can you avoid displaying the portal alias in query string when accessing child portal?

    10-12-2005, 9:10 PM
    • Loading...
    • ikamiksok
    • Joined on 11-12-2003, 12:08 PM
    • Posts 247
    • Points 1,235
     J7Mitch wrote:

    If you have several and can handle the re-direct with a tabid, then a better approach is to just make your child portal default page redirect to that tabid and take all the other processing out of the child's default.aspx page like I mentioned earlier.


    Oooh. Good idea. Thanks a bunch!

    Jason
Page 1 of 1 (14 items)