Register   Login
     
  Latest Posts  
RE: How do I - templates
by cptkoi on 12/03/2008 8:19 PM
Notification on comment and multiple authors
by ba on 12/03/2008 8:14 PM
Private Messages 1.07 - Potential Display Name Bug
by blob150 on 12/03/2008 5:16 PM
Removal of "Actions" section...
by jlatulippe on 12/03/2008 5:08 PM
RE: MultiSelect Search on Multiple Checkbox
by smcculloch on 12/03/2008 3:46 PM
RE: Property Agent Latest Filter
by erikvb on 12/03/2008 3:45 PM
RE: Help! property type error
by smcculloch on 12/03/2008 3:44 PM
RE: Property Agent Latest Filter
by smcculloch on 12/03/2008 3:42 PM
RE: Set default value
by smcculloch on 12/03/2008 3:42 PM
RE: Can an entry belong to multiple types?
by smcculloch on 12/03/2008 3:42 PM
  Forums  
Subject: URLRewrite for multiple portals?
Prev Next
You are not authorized to post a reply.

Author Messages
qiuylUser is Offline
Registered Users
Nuke Newbie
Nuke Newbie
Posts:5

6/25/2008 9:41 PM  

I do not how to explain my problem clearly. Here is the example.

http://www.mysite1.com/people.aspx is sent to http://www.mysite.com/?tabid=58 and it works perfectly and no addtional urlrewrite rule is required (only add humanfriendURL attribute to the config file).

Now I want to transfer a value to a page/module:
http://www.mysite1.com/people.aspx?lastname=Joe, and it works perfectly. I want to get a friendly URL, then by using urlfriend:

http://www.mysite1.com/people/joe.aspx and it works greatly without any problem when applying the rule

*/people/(.*)_.aspx ==> ~/Default.aspx?TabID=58&lastname=$1

Now problem is coming out if I have multiple portals and I have the same tabPath but the tabID is different:
http://www.mysite2.com/people.aspx is sent to http://www.mysite1.com/?tabid=99

To get the same firendly URL, I want to get:
Http://www.mysite2.com/people/mark.aspx

If I write the rule for multiple porals:
*/people/(.*).aspx ==> ~/people/?lastname=$1

it does not work because the people folder is not founded.

I know there are two ways which can work out:

1. if I write the RewriteRule one by one:
mysite1.com/people/.(*).asp ==> mysite1.com/?tabid=58&lastname=$1
mysite2.com/people/.(*).asp ==> mysite2.com/?tabid=99&lastname=$1

However I do not want to add the rules in hard code one by one.

2. Setup a real file in real folder in website as /people/default.aspx, and setup one single rewrite rule for all portals as

*/people/(.*).aspx ==> ~/people/?lastname=$1

When the real file /people/default.aspx receives a request, it will look for the portal ID/alias by parsing the URL, then look for the tabID for the tab in the portal, then finally redirect the request to portalURL/?tabid=xx&lastname=xxx

I think the URLRewrite module can parse the URL for two times:
1st time: site.com/people/joe.aspx ==> site.com/people.aspx?lastname=joe
2nd time: site.com/people.aspx?lastname=joe  ==> site.com/tabid=xxx&lastname=joe

Is any other better way to work it out?

Thank you!

 

qiuylUser is Offline
Registered Users
Nuke Newbie
Nuke Newbie
Posts:5

6/26/2008 10:04 PM  

I have figured out the problem. It may not the best solution, but it works very well. First step: parse URL by rules; second step: parse URL by tabPath.

1. Assuing all portals (multi-parent portals, multi-child portals) have a tab as "people.aspx" and this tab in all portals uses the same module to display people information. The people.aspx could be in any level such as http://www.site1.com/group/people.aspx or http://www.site2.com/research/project1/people.aspx)

2. Write one single rewriteURL rule for people.aspx tab in all portals:
look for: (*.)/people/(.*).aspx
sendTo: $1/people.aspx?lastname=$2&parseURLagainbyTabPath=true

3. modify the urlrewrite code which is in the file of UrlRewriteModule.vb. My psudo code:

firstrun_sendto = RewriteUrlByRules(....) The code has been provided by DNN4.8+.

The firstrun_sendto will like "localhost/dotnetnuke/people.aspx?lastname=abc&parseURLagainbyTabPath=true". In this example, losthost/dotnetnuke is a portal alise; people.aspx is a tabPath.

if (firstrun_sendto.endwith("parseURLagainbyTabPath=true") then
second_sendto = RewriteUrlByTabPath(....)

The "rewriteUrlByTabPath" has already well written by the source code provided in DNN4.8+. All need to do is to change the code flow a little bit. The code first parses portal alise and tabpath name by extracting value from the string of firstrun_sendto, then it look for tabID by portal alise/portalID and tabPath. With portalID and tabID, rewriting URL is just a piece of cake which caveman can do.

After the second parse, the sendto will like "whateverportal_alias/?tabid=xxx&lastname=xxxx"

The performance of the URL parse is almost the same as before.

Done!

You are not authorized to post a reply.
Forums > Projects > Friendly Urls > URLRewrite for multiple portals?



ActiveForums 3.7