Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Child Portal redirect to Main Portal with ?alias= query stringChild Portal redirect to Main Portal with ?alias= query string
Previous
 
Next
New Post
9/9/2009 4:21 AM
 

Hi,

I found this problem yesterday and until today I found only in ASP.NET and snapsis.com in the past few years. Until DNN 5.x now, it still redirect. I am not sure if it considered not an issue or have a n option to enable/disable. I not found the realted issue anywhere else and this DNN forum today.

This happened when we go to http://www.domain.com/childportal/ and it will redirect to http://www.domain.com/Default.aspx?alias=www.domain.com/childportal.

But this will not happened when we go to http://www.domain.com/childportal/Home.aspx (Human friendly enabled)

Both this three link refering the same home page of child portal but this redirection have some problem. The most important is it was not a good idea for SEO and user will get confused. I am not sure about creating new parent portal whether http://www.domain2.com/ will redirect to http://www.domain.com/Default.aspx?alias=www.domain2.com. If happened, surely it is a bad idea.

Based on that links, the curent solution is using url rewriting and most have problem if we want to handle much child portal.

Here I want to share the better solution I modify from them:

 

Before that I want to tell the interested things in regex to perform url rewriter. Opening and closing bracket "(" and ")" called capturing group used to 'capture' anything inside it so that we can grab the value. In this url rewriter, we use capturing group in LookFor to copy the child portal name to SendTo url, paste by using $number format where number is the capturing group #. Its useful if we have many child portal that is difficult to add in the SiteUrls.config one by one.

This is my problem because I want to make a lot of child portal, each represent as a specific language site, mirror to the main portal. DNN 5.1.x still not 'fully' multi language to the end user including menu caption and text/html content. (I notice that it will be start to implement in 5.2.x).

In a basic use like this:
LookFor > http://www.domain.com/([^/]*)/Default.aspx
SendTo > ~/Default.aspx?alias=www.domain.com/$1

[^/]* means any letters except "/". We should use this instead of .* because it accept any letters including "/" and we want to make sure it is not a child-child folder or even /TabId/123/Default.aspx that is need to pass to the last SiteUrls.config rule for TabId. You can see the () is the place of child portal, it will be copied to $1. Note that I include absolute url from http... instead of */([^/]*)/Default.aspx because we need to consider http://www.domain.com/path1/path2/path3/Default.aspx also is a match.

Simply you can change like this if you consider about https:
LookFor > (?:http://|https://)www.domain.com/([^/]*)/Default.aspx
SendTo > ~/Default.aspx?alias=www.domain.com/$1

Note that (?: ) is non capturing group. So this () will not counting and $1 remain refer to the second (), child portal name.

We are done.

By using this single rule we can map all child portal to its alias query string.


Now in advance way. Sometimes I want to use the DNN site locally and do some testing. So we also need to copy the host url www.domain.com to the SendTo because it can be localhost or 127.0.0.1.

So this is the result:
LookFor > (?:http://|https://)([^/]*)/([^/]*)/Default.aspx
SendTo > ~/Default.aspx?alias=$1/$2

The second and third () is the host name and child portal name will be copied to $1 and $2 respectively. You can replace second () host name by checking valid url regex. I think it is not important and will make url rewriter more work, just make sure there is no "/" in the host url.

Another problem, normally in localhost we are not using the site in default website (http://localhost/) instead we put it in virtual directory so that more than site can be testing in the local (http://localhost/DNNSite). So we need to add exception for localhost with virtual directory. As a result ([^/]*) will become (localhost/[^/]*|127.0.0.1/[^/]*|[^/]*). It will tell url rewriter to check for localhost/[^/]* first then 127.0.0.1/[^/]* and lastly [^/]*.

The end result is:
LookFor > (?:http://|https://)(localhost/[^/]*|127.0.0.1/[^/]*|[^/]*)/([^/]*)/Default.aspx
SendTo > ~/Default.aspx?alias=$1/$2

By using this single rule we can map any host including:
http://www.domain.com/de/ to http://www.domain.com/Default.aspx?alias=www.domain.com/de
http://www.domain.com/fr/ to http://www.domain.com/Default.aspx?alias=www.domain.com/fr
https://www.domain.com/fr/ to https://www.domain.com/Default.aspx?alias=www.domain.com/fr
http://localhost/DNNProject/fr/ to http://localhost/DNNProject/Default.aspx?alias=localhost/DNNProject/fr
http://127.0.0.1/DNNProject/fr/ to http://127.0.0.1/DNNProject/Default.aspx?alias=127.0.0.1/DNNProject/fr
as well as http://www.domain.com:8080/jp/ to http://www.domain.com:8080/Default.aspx?alias=www.domain.com/jp (not tested but sure)

However this is complex rule and the performance affected is higher because each page loading need to perform the regex match this rule and the others. You can choose either one solution that suite to your site. If you consider for performance then you need to do something with Default.aspx inside each child portal folders which is responsible to redirect the url to main portal ~/Default.aspx?alias=.

CallMeLaNN

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Child Portal redirect to Main Portal with ?alias= query stringChild Portal redirect to Main Portal with ?alias= query string


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out