Register   Login
     
  Latest Posts  
RE: Removal of "Actions" section...
by smcculloch on 12/05/2008 3:17 PM
RE: Gallery Module causes System Out of Memory
by smcculloch on 12/05/2008 3:16 PM
RE: Removal of "Actions" section...
by jlatulippe on 12/05/2008 3:09 PM
RE: Removal of "Actions" section...
by jlatulippe on 12/05/2008 2:17 PM
RE: News Articles Tokens
by sistemi on 12/05/2008 11:27 AM
A few Questions
by mfuller on 12/05/2008 11:22 AM
Gallery Module causes System Out of Memory
by jeremias_t on 12/05/2008 10:30 AM
RE: Google Checkout?
by rion on 12/05/2008 4:34 AM
RE: image path in RSS
by robax on 12/05/2008 3:51 AM
RE: Display Name
by SteveJ on 12/05/2008 3:34 AM
  Forums  
Subject: How to make your url look like mysite.com/events/23/my-event.aspx
Prev Next
You are not authorized to post a reply.

Author Messages
Jason KoskimakiUser is Offline
Registered Users
Nuke Wiz
Nuke Wiz
Posts:194

9/18/2006 11:18 AM  

I made a comment previously but decided to create a new thread title so ppl can more easily find this. Here is a thread on doing this:

http://www.ventrian.com/Support/ProductForums/tabid/118/forumid/35/postid/10876/view/topic/Default.aspx

I plan on posting an updated and better solution in this thread here shortly.

You can see a live example of this working via:

http://www.yapclub.com/events/76/yap-vegas-2006.aspx

Also, with a similar customization you also could choose to do

mystite.com/events/23.aspx

Note these are hardcoded site specific solutions and not a general solution that works for any site. And there is a possible issue with search engine indexing I am looking into.

Jason


Social Networking Site for Young Professionals - My DNN Site w/ lots of Ventrian Modules
Scott McCullochUser is Offline
Administrators
Nuke Master
Nuke Master
Posts:12600


9/18/2006 3:24 PM  
Jason, did you get the HttpHeader issue sorted out? (you were saying you were being redirected ?)

Scott McCulloch
Site Administrator
Jason KoskimakiUser is Offline
Registered Users
Nuke Wiz
Nuke Wiz
Posts:194

9/18/2006 3:32 PM  

I am still looking into it. Everything seems to return the correct codes and behave normally. So perhaps it's just a coincidence and my site has problems. But I am trying some more things so we'll see....

Jason


Social Networking Site for Young Professionals - My DNN Site w/ lots of Ventrian Modules
Scott McCullochUser is Offline
Administrators
Nuke Master
Nuke Master
Posts:12600


9/18/2006 3:34 PM  
I downloaded Fiddler yesterday for some AJAX work I had been doing. It should be able to pick up any redirects.

Scott McCulloch
Site Administrator
Jason KoskimakiUser is Offline
Registered Users
Nuke Wiz
Nuke Wiz
Posts:194

9/20/2006 3:00 PM  
Got another thing I am trying I think will work. Problem with all these tests is I have to sit and wait some arbitrary amount of time to see if anything indexes until I decide it didn't work and have to try something else. :)

Initially, I had this link
http://www.yapclub.com/events/76/yap-vegas-2006.aspx
which redirected to default.aspx?tabid=56 (my events page) and so typing
http://www.yapclub.com/default.aspx?tabid=56 brought my events page only

Then I tried this change with my link
http://www.yapclub.com/events/76/yap-vegas-2006.aspx
which redirected to default.aspx?tabid=56&events=76 (which still redirects to my events page as my code extracts the id from /events/76/)
and so http://www.yapclub.com/default.aspx?tabid=56&events=76 still brings up events page

And now I will try it again
http://www.yapclub.com/events/76/yap-vegas-2006.aspx
which will still redirect to default.aspx?tabid=56&events=76 (but this time my codebehind will load page based on events=76)
and so the link http://www.yapclub.com/default.aspx?tabid=56&events=76 will load the specific event and not events page.

We'll see if that works. Perhaps yahoo can see the url redirected to (http://www.yapclub.com/default.aspx?tabid=56&events=76) as opposed to the url displayed (http://www.yapclub.com/events/76/yap-vegas-2006.aspx) and penalizes because the two do not match. Is that possible?

Jason

Social Networking Site for Young Professionals - My DNN Site w/ lots of Ventrian Modules
Scott McCullochUser is Offline
Administrators
Nuke Master
Nuke Master
Posts:12600


9/21/2006 6:26 AM  
You would want Yahoo to see the URL (http://www.yapclub.com/events/76/yap-vegas-2006.aspx) rather then the internally directed URL wouldn't you?

Scott McCulloch
Site Administrator
Jason KoskimakiUser is Offline
Registered Users
Nuke Wiz
Nuke Wiz
Posts:194

9/21/2006 9:02 AM  
Yes. I don't know why yahoo won't index these pages so I'm trying every little thing I can think of. I'm not an expert and so don't know how things work enough to know what to try so I'm trying anything. Reason I tried this was in case some of that internal url rewriting can be detected by a search engine or perhaps asp.net may have a quirk or something if you don't do it exactly right. Next thing I'll try is how my controls are loaded on each page. And also, I disable viewstates on pages dynamically and so will see if that may be a factor too. Would like to finally get to the bottom of this so my pages will index and I can give everyone the ok on my urlrewriter code mod I shared.

Jason

Social Networking Site for Young Professionals - My DNN Site w/ lots of Ventrian Modules
Scott McCullochUser is Offline
Administrators
Nuke Master
Nuke Master
Posts:12600


9/21/2006 9:48 PM  
It will take time to index new URLs once you have changed them, you are allowing for this?

Scott McCulloch
Site Administrator
Jason KoskimakiUser is Offline
Registered Users
Nuke Wiz
Nuke Wiz
Posts:194

9/25/2006 9:32 AM  
Yes. I do have other recent urls without a parameter that are getting listed. THe problem is this is difficult to measure. So after a couple months I know something is wrong but I don't know if it is because of the url change I made or if that was just a coincidence and there is something else. For instance, along with the change to rewrite the url I also dynamically load a control based on the parameter so perhaps I am doing something wrong with that.

My next steps will be to try some fake demo\test pages covering many different scenarios and then wait and see which if any get indexed.

Jason

Social Networking Site for Young Professionals - My DNN Site w/ lots of Ventrian Modules
Jason KoskimakiUser is Offline
Registered Users
Nuke Wiz
Nuke Wiz
Posts:194

10/05/2006 9:30 AM  

OK. One of the many things I tried ended up fixing my problem as I am now indexing in yahoo again on these url rewritten pages.  I will post my updated code shortly now that I know it is not a cause of indexing problems.

Jason


Social Networking Site for Young Professionals - My DNN Site w/ lots of Ventrian Modules
Scott McCullochUser is Offline
Administrators
Nuke Master
Nuke Master
Posts:12600


10/05/2006 4:54 PM  
Hi Jason,

That would be great! Thanks for sharing.

Scott McCulloch
Site Administrator
Jason KoskimakiUser is Offline
Registered Users
Nuke Wiz
Nuke Wiz
Posts:194

10/06/2006 1:12 AM  

Here is my code from urlrewritemodule. Note this is a customized hardcoded solution you can use for a single website only. It is also written for child portals so may need tweaking if you are not accessing urls at domain instead of domain/child/ as the extra / affects parsing.

So if you had domain/child/events/34/my-event-name.aspx in your code you would do a request.pararms("events") to get 34.

Note I also added a case if a tab was not found. In that case I redirect to my tabname 'guide'. And my code extracts 'whatever' from whatever.aspx and redirects it with the parameter name of my choosing (in this case topic). So what happens is my wiki module does a request.param("topic") and gets topic==whatever when I enter a url domain.com/child/whatever.aspx by rewriting it to domain/child/default.aspx?tabid=xyz&topic=whatever.

Private Function checkYAPTabPath(ByVal tabpath As String, ByVal yapToken As String, ByVal directedTab As String, Optional ByRef qs As String = "") As String

If tabpath.IndexOf(yapToken) >= 0 Then

tabpath = tabpath.Replace("//", "/")

Dim locSplit As String()

locSplit = tabpath.Split("/".ToCharArray)

If locSplit.Length > 2 Then

qs = "&" & yapToken & "=" & locSplit(2)

tabpath = "//" & locSplit(1) & "//" & locSplit(locSplit.Length - 1)

tabpath = tabpath.Substring(0, tabpath.LastIndexOf("//")).Replace("//" & yapToken, "") & "//" & directedTab

Else

tabpath = "//" & locSplit(1)

' qs = "&" & yapToken & "=" & locSplit(2)

End If

End If

Return tabpath

 

End Function

 

Private Function IdentifyByTabPath(ByVal app As HttpApplication) As Boolean

Dim domain As String = ""

Dim url As String = app.Request.Url.ToString()

If (url.ToLower().StartsWith("http://")) Then

url = url.Replace("http://", "")

End If

' Remove QueryString if it exists

If (app.Request.Url.Query <> "") Then

url = url.Replace(app.Request.Url.Query, "")

End If

Dim wikiTabID As Integer = 0

Dim splitUrl() As String = url.Split(Convert.ToChar("/"))

Dim tabPath As String

Dim myAlias As String = ""

If (splitUrl.Length > 0) Then

For Each urlPart As String In splitUrl

If (myAlias = "") Then

myAlias = urlPart

Else

myAlias = myAlias & "/" & urlPart

End If

Dim objPortalAlias As PortalAliasInfo = PortalSettings.GetPortalAliasInfo(myAlias)

If Not objPortalAlias Is Nothing Then

Dim portalID As Integer = objPortalAlias.PortalID

' Identify Tab Name

tabPath = url.Replace(myAlias, "").ToLower()

' Default Page has been Requested

If (tabPath = "/" & glbDefaultPage.ToLower()) Then

Return True

End If

If (tabPath = "/login.aspx") Then

RewriterUtils.RewriteUrl(app.Context, "~/" & glbDefaultPage & "?portalid=" & portalID.ToString() & "&ctl=login")

Return True

End If

If (tabPath = "/register.aspx") Then

RewriterUtils.RewriteUrl(app.Context, "~/" & glbDefaultPage & "?portalid=" & portalID.ToString() & "&ctl=Register")

Return True

End If

If (tabPath = "/terms.aspx") Then

RewriterUtils.RewriteUrl(app.Context, "~/" & glbDefaultPage & "?portalid=" & portalID.ToString() & "&ctl=Terms")

Return True

End If

If (tabPath = "/privacy.aspx") Then

RewriterUtils.RewriteUrl(app.Context, "~/" & glbDefaultPage & "?portalid=" & portalID.ToString() & "&ctl=Privacy")

Return True

End If

If (tabPath = "/signup.aspx") Then

tabPath = "/users.aspx"

End If

 

If (tabPath = "/restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/bars.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/activity-venues.aspx") Then

tabPath = "/mycity.aspx"

ElseIf tabPath.IndexOf("-theaters.aspx") >= 0 Then

If (tabPath = "/indie-theaters.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/movie-theaters.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/movie-grill-theaters.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/stage-theaters.aspx") Then

tabPath = "/mycity.aspx"

End If

ElseIf tabPath.IndexOf("/dallas-") >= 0 Then

If (tabPath = "/dallas-restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-night-clubs.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-bars.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-golf-courses.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-comedy-clubs.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-piano-bars.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-chinese-restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-american-restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-steak-restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-japanese-restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-pizza-restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-movie-theaters.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dallas-hotels.aspx") Then

tabPath = "/mycity.aspx"

End If

ElseIf tabPath.IndexOf("/fort-worth-") >= 0 Then

If (tabPath = "/fort-worth-bars.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/fort-worth-night-clubs.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/fort-worth-restaurants.aspx") Then

tabPath = "/mycity.aspx"

End If

ElseIf tabPath.IndexOf("-bars.aspx") >= 0 Then

If (tabPath = "/martini-bars.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/piano-bars.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/sports-bars.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/karaoke-bars.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/country-bars.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/dive-bars.aspx") Then

tabPath = "/mycity.aspx"

End If

ElseIf (tabPath = "/steak-houses.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/cafe-diners.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/coffee-houses.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/delicatessens.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/ice-cream-parlors.aspx") Then

tabPath = "/mycity.aspx"

ElseIf tabPath.IndexOf("-restaurants.aspx") >= 0 Then

If (tabPath = "/american-restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/sushi-restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/tapas-restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/thai-restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/vegetarian-restaurants.aspx") Then

tabPath = "/mycity.aspx"

ElseIf (tabPath = "/vietnamese-restaurants.aspx") Then

tabPath = "/mycity.aspx"

End If

End If

 

tabPath = tabPath.Replace("/", "//")

tabPath = tabPath.Replace(".aspx", "")

Dim yapQS As String = "" 

tabPath = Me.checkYAPTabPath(tabPath, "locations", "mycity", yapQS)

tabPath = Me.checkYAPTabPath(tabPath, "museums", "mycity", yapQS)

tabPath = Me.checkYAPTabPath(tabPath, "casinos", "mycity", yapQS)

tabPath = Me.checkYAPTabPath(tabPath, "parks", "mycity", yapQS)

tabPath = Me.checkYAPTabPath(tabPath, "restaurants", "mycity", yapQS)

tabPath = Me.checkYAPTabPath(tabPath, "theaters", "mycity", yapQS)

tabPath = Me.checkYAPTabPath(tabPath, "trails", "mycity", yapQS)

  

Dim objTabController As New TabController

Dim objTabs As ArrayList = objTabController.GetTabs(portalID)

For Each objTab As TabInfo In objTabs

If objTab.TabName.ToLower = "guide" Then

wikiTabID = objTab.TabID

End If

If (objTab.IsDeleted = False And objTab.TabPath.ToLower() = tabPath) Then

RewriterUtils.RewriteUrl(app.Context, "~/" & glbDefaultPage & "?TabID=" & objTab.TabID.ToString() & yapQS)

Return True

End If

Next

Else

End If

Next

If wikiTabID > 0 Then

RewriterUtils.RewriteUrl(app.Context, "~/" & glbDefaultPage & "?TabID=" & wikiTabID.ToString() & "&topic=" & tabPath.Replace("//", "").Replace("-", "+"))

Return True

End If

 

 

Else

' Should always resolve to something

Return False

End If

End Function


Social Networking Site for Young Professionals - My DNN Site w/ lots of Ventrian Modules
Jason KoskimakiUser is Offline
Registered Users
Nuke Wiz
Nuke Wiz
Posts:194

10/14/2006 6:54 AM  
Note in my above posted source I have a redirect to a wiki. This cool hack of mine recently failed with a webserver update. Problem is this code above would redirect image\thumbnail handling code (calls to desktopmodules\simplegallery\imagehandler.ashx for example) . So what I did is I added a flag in the beginning of the code to not redirect if desktopmodules is in the path. Another specific hack but it works now.....

If urlPart.ToLower = "desktopmodules" Then
isWiki = False
End If

Social Networking Site for Young Professionals - My DNN Site w/ lots of Ventrian Modules
Scott McCullochUser is Offline
Administrators
Nuke Master
Nuke Master
Posts:12600


10/15/2006 6:53 AM  
FYI, you can use code tags (with angle brackets) to post code.

Scott McCulloch
Site Administrator
maoker maoUser is Offline
Registered Users
Nuke Newbie
Nuke Newbie
Posts:1

10/20/2006 1:45 PM  
How can i add a new thread?
Scott McCullochUser is Offline
Administrators
Nuke Master
Nuke Master
Posts:12600


10/21/2006 6:24 AM  
Posted By maoker.mao on 10/20/2006 1:45 PM
How can i add a new thread?

Click Add New Topic in the main forum.

Scott McCulloch
Site Administrator
colin robsonUser is Offline
Registered Users
Nuke Newbie
Nuke Newbie
Posts:7


10/24/2006 10:00 AM  
@Koskimaki:

i've looked with great interest at your solution for friendly urling. and i'm going to try and integrate this into catalook (you might remember the thread!)

now basically, am i going to have to write a seperate "else if " for each product in my store? i hope not :(

in my previous thread i mentioned about having lots of multiple parameters. now i've had an experiment and i can actually get rid of the sortby and level parameters (sortby is controlled from within the stored procxedure now) and level is always going to be 1. so my intended urls can look like

www.mysite.com/HOME//

i basically want HOME to resolve to the tabid of the page in which the store is held.
category to resolve to the CategoryID parameter
productname to resolve to productID parameter.

now having re-read my thread i'm under a bit of confusion about where this need to be done. Does it need to be done in the HttpUrlRewriter module in DNN or in catalook? or both?

i'd really appreciate some in depth help on this.

Many Thanks

Colin.
colin robsonUser is Offline
Registered Users
Nuke Newbie
Nuke Newbie
Posts:7


10/24/2006 10:01 AM  
Should be

www.mysite.com/HOME/category/productname.aspx
You are not authorized to post a reply.
Forums > Projects > Friendly Urls > How to make your url look like mysite.com/events/23/my-event.aspx



ActiveForums 3.7