Dennis van der Stelt

If you have one problem and use cache to solve it, you now have two problems.

Community

Email Notifications

News

  • Addicted to Refactor! Pro

I read...

I Use...

Tags

Recent Posts

Archives

Blog Subscription Form

  • Email Notifications
    Go

Community Server & Redirect of old urls

We've been running on .Text for quite a while, but continue to find bugs in it. Especially the fact that randomly, people cannot edit the items they have just placed on their blog is an annoying one.

We are hoping to solve a lot of problems by upgrading to Community Server from Telligent Systems. The reason why we haven't upgraded in the past, is because of the new location of the pages. Version 1.1 has become more flexible on the location of the community site and I've found a very small but excellent component for url rewriting. I've done some of the coding myself at first, but with this component I don't have to reinvent the wheel as it has all functionality I want.

Via Mischa Kroon I've found the link to this url rewriting component. It reads settings from your web.config to see what page(s) it has to redirect and whereto. This is very flexible as it also works with regular expressions. For all Community Server junkies or people that are afraid to upgrade (like I was), here's what I did.

Remember, these instructions are for CS 1.1 but should work anywhere.
I'll first explain the current and new situations. In the current situation, the url is like bloggingabout.net/username/ whereas the new situation will be bloggingabout.net/blogs/username/. There are a lot of possible directories and files behind those urls, so it should definitly be solved by a regular expression. Here's how I did it.

First, download the component, unzip it and in the directory /demo/bin/ you can find two .dll files. Copy those to the /bin/ directory on your website.
Now you have to edit your web.config and you are done! First, find the <httpmodules> tag. If you haven't added anything, make it look like this.

   1:  <httpModules>
   2:      <add name="RedirectModule" type="Madgeek.Web.RedirectModule, Madgeek.RedirectModule" />
   3:      <add name="CommunityServer" type="CommunityServer.CSHttpModule, CommunityServer.Components" />
   4:      <add name="Profile" type="Microsoft.ScalableHosting.Profile.ProfileModule, MemberRole (...) 7562"/>
   5:      <add name="RoleManager" type="Microsoft.ScalableHosting.Security.RoleManagerModule, M (...) 7562" />
   6:  </httpModules>

At line 2 you can see the line I added. I've truncated some of the content (in line 4 and 5) so it won't be that long.
Now you add another line to your configSections.

   1:  <configSections>
   2:      <sectionGroup name="memberrolesprototype">        
   3:          <section name="membership" type="Microsoft.ScalableH (...) 7562"/>
   4:          <section name="roleManager" type="Microsoft.ScalablH (...) 7562"/>
   5:          <section name="profile" type="Microsoft.ScalableHost (...) 7562"/>
   6:          <section name="anonymousIdentification" type="Micros (...) 7562"/>            
   7:      </sectionGroup>
   8:      <section name="redirections" type="Madgeek.Configuration.XmlSerializerSectionHandler, Madgeek.RedirectModule" />
   9:  </configSections>

This time you can see the added section at line 8.

Now all you have to do is add your redirection part. Mine looks like this:

   1:  <redirections type="Madgeek.Web.ConfigRedirections, Madgeek.RedirectModule">
   2:      <add permanent="true" ignoreCase="true" targetUrl="^/MainFeed.aspx" destinationUrl="/blogs/MainFeed.aspx" />
   3:      <add permanent="true" ignoreCase="true" targetUrl="^/(dennis|rj|patrick)/(.*).aspx\??(.*)" destinationUrl="~/blogs/$1/$2.aspx" />
   4:  </redirections>

In line two the main rss feed is redirected to the new location. This only concerns one file and is, as it looks, very easy. But now the current blogs to their new location. The third line tells that it should look for directories starting with either dennis, rj, or patrick and forward those to the destination url. I will have to include all bloggers currently in our community in the final version though. The regex will place the found user-directory at the $1 location and the complete directory structure after that and the file behind it at the $2 location. It should forward every .aspx file.

You can also see the parameter permanent which is set to true. This will make the component send an error 303. This tells the search engines like Google that it's a permanent move of the file. The search engine will then update its index, which was very important for us.

I'll do some additional tests soon and hope to be able to upgrade BloggingAbout.NET without any problems.

Comments

Dennis van der Stelt said:

Wanneer heb je het af... over een uurtje ;-). Hopelijk is het snel gefixed dan kan ik eindelijk eens wat gaan bijdragen.
# June 28, 2005 3:48 PM

Dennis van der Stelt said:

Goed gedaan Dennis!!!!
# June 28, 2005 3:53 PM

Dennis van der Stelt said:

Just wondering. Do we, as bloggers need to do anything after the server has been upgraded?
# June 28, 2005 3:58 PM

TrackBack said:

As some of you may have noticed, ever since I moved Community Server to the root of nino.net, I have...
# July 6, 2005 3:43 PM

Dennis van der Stelt said:

I wrote a similar utility, though as an httpHandler that you can plug into .Text:

http://communityserver.org/forums/483517/ShowPost.aspx
# July 7, 2005 9:56 AM

Blogging About .NET said:

As you could see I've completed too the migration from nGallery to CommunityServer, without major incidents...
# October 6, 2005 1:18 AM

Blogging About .NET said:

As you could see I've completed too the migration from nGallery to CommunityServer, without major incidents...
# October 6, 2005 1:22 AM

Nix's Blog said:

Les blogs CodeS-SourceS viennent d'&#234;tre migr&#233; sur CommunityServer. (Peut-&#234;tre avez-vous remarqu&#233; un &quot;l&#233;ger&quot;...
# October 21, 2005 5:51 AM

Nix's Blog said:

Les blogs CodeS-SourceS viennent d'&#234;tre migr&#233; sur CommunityServer. (Peut-&#234;tre avez-vous remarqu&#233; un &quot;l&#233;ger&quot;...
# October 27, 2005 12:15 PM

VincentAngelita said:

I received 1 st <a href="http://lowest-rate-loans.com">loan</a> when I was 25 and that supported me a lot. But, I require the collateral loan also.

# May 7, 2010 7:41 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 5 and 6 and type the answer here: