How To: Redirecting in Community Server 2007
When I updated this site to CS2007, some of the pages broke. The two problems came up due to older configurations of this site. First, in a very old config, I had my RSS feed at /RSS/default.aspx. The other problem came about because I used to have the blog page at the root and now I have gone back to the default way of doing things. So let me show you how I solved both issues.
First the part about redirecting RSS/default.aspx. Actually this has nothing to do with Community Server. I simply went to my hosting provider's control panel site and created a virtual directory that pointed to the RSS feed, which is now hosted at Feedburner.
OK, that was easy. Redirecting the requests to blog pages at the root to now go to /blogs/technovangelist was a bit tougher. There were actually two main problems here: How do I redirect rss.aspx in the root of the site, and how do I redirect all of the calls to the archive blog postings that were under /archive to /blogs/technovangelist/archive.
The first of those two happened to be fairly easy. I simply created an rss.aspx page in the root with the following content:
Actually, it was a bit simpler than that. The actual process was search the net to find Hansleman's entry on solving the problem.
To solve the problem with the archive pages I got to take advantage of the new SiteUrls_Override.config file. Here is my config file with some of the non relevant lines removed:
xml version="1.0" encoding="utf-8" ?>
<Overrides>
<Override xpath="/SiteUrls/locations" mode="add">
<location name="OldBlogPathRedirect" themeDir="blogs" path="/"
type="CommunityServer.Blogs.Components.BlogLocation, CommunityServer.Blogs" >
<url name = "Oldweblogday"
path="/blogs/technovangelist/archive/{1}/{2}/{3}.aspx"
pattern="archive/(\d{4})/(\d{1,2})/(\d{1,2})\.aspx"
physicalPath="##blogthemeDir##"
vanity="{2}?App=${{app}}&y=$1&m=$2&d=$3" page="postlist.aspx" />
<url name = "Oldweblogmonth"
path="/blogs/technovangelist/archive/{1}/{2}.aspx"
pattern="archive/(\d{4})/(\d{1,2})\.aspx"
physicalPath="##blogthemeDir##"
vanity="{2}?App=${{app}}&y=$1&m=$2&d=1" page="postlist.aspx" />
<url name = "OldweblogpostId"
path="/blogs/technovangelist/archive/{1}/{2}/{3}/{4}.aspx"
pattern="archive/(\d{4})/(\d{1,2})/(\d{1,2})/(\d+)\.aspx"
physicalPath="##blogthemeDir##"
vanity="{2}?App=${{app}}&y=$1&m=$2&d=$3&PostID=$4"
page="post.aspx" />
<url name = "OldweblogpostName"
path="/blogs/technovangelist/archive/{1}/{2}/{3}/{4}.aspx"
pattern="archive/(\d{4})/(\d{1,2})/(\d{1,2})/([a-zA-Z0-9\-\._]*?)\.aspx"
physicalPath="##blogthemeDir##"
vanity="{2}?App=Technovangelist&y=$1&m=$2&d=$3&PostName=$4"
page="post.aspx" />
<url name = "Oldweblogpostcategory"
path="/blogs/technovangelist/archive/category/{1}.aspx"
pattern="archive/category/(\d+)\.aspx"
physicalPath="##blogthemeDir##"
vanity="{2}?App=${{app}}&CT=BlogPost&CategoryID=$1"
page="postlist.aspx" />
<url name = "Oldweblogarticlecategory"
path="/blogs/technovangelist/articles/category/{1}.aspx"
pattern="articles/category/(\d+)\.aspx"
physicalPath="##blogthemeDir##"
vanity="{2}?App=${{app}}&CT=BlogArticle&CategoryID=$1"
page="postlist.aspx" />
</location>
</Override>
</Overrides>
As you you may be able to see, I just copied the lines from the SiteUrls.config file, then modified a few of the values. I am sure there is a more elegant way to do it, but this worked. If you know of a better way to handle this, please let me know.


Monday, June 18, 2007 at 6:23AM
Reader Comments (7)
Good stuff, TechnoV!
Actually with the way it is now set up both of the following urls work:
http://technovangelist.com/blogs/technovangelist/archive/2007/06/18/how-to-redirecting-in-community-server-2007.aspx">technovangelist.com/.../how-to-redirecting-in-community-server-2007.aspx
and
http://technovangelist.com/archive/2007/06/18/how-to-redirecting-in-community-server-2007.aspx">technovangelist.com/.../how-to-redirecting-in-community-server-2007.aspx
Ahhh, so you're getting rid of the /blogs/technovangelist, not the archives.
blog bits Ben Tiedt with the most detailed and complete article written to date on using CS2007 Sub-forms
blog bits Ben Tiedt with the most detailed and complete article written to date on using CS2007 Sub-forms
um, well, no. I am not getting rid of anything. I am only adding. to get to any post, you go to technovangelist.com/blogs/technovangelist/[rest of url] or technovangelist.com/[rest of url]. so that way the standard url works as well as the recommended way to set up a single blog at the root. Since this used to be the single blog at the root, there are still plenty of links to pages at the root. When I switched back, those links were breaking. This fixed that.
The Technovangelist gets rid of the "blogs/myblog" in http://site.com/blogs/myblog/archive">site.com/.../archive