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
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.
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:
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.</httpmodules>