· Chris Hammond
Last Updated

Part 7: CommunityServer to DotNetNuke handling URLs

Learn how to handle old CommunityServer URLs in DotNetNuke for better SEO and user experience. Redirect CS URLs to DNN with ease in this informative guide.

Learn how to handle old CommunityServer URLs in DotNetNuke for better SEO and user experience. Redirect CS URLs to DNN with ease in this informative guide.

CommunityServer to DotNetNuke Blog Series - Part 7

This will be a quick blog post talking about “URLs” and how you can handle the old CommunityServer URLs and redirect them to the proper DotNetNuke URLs.

Why would you do this? SEO, bookmarks, and existing links. You want people that try to access the CS URLs to be redirected properly to the appropriate DotNetNuke URL, be it for a forum post, blog post, or other.

This post isn’t going to cover all the specifics, as there are too many possible variations based on the configuration of your specific website, but hopefully, it will provide you an overview of how I handled things in my conversion, and get you on the way to handling them in your conversion.

Previous Posts:

  • Part 1: An Introduction
  • Part 2: DotNetNuke Installation
  • Part 3: Converting users from CommunityServer to DotNetNuke
  • Part 4: Getting the conversion tables ready for CS to DNN
  • Part 5: Moving Forum threads from CommunityServer to DotNetNuke
  • Part 6: Community Server to DotNetNuke Moving Forum Replies and Attachments

Assumptions

In order to do what I have done for URL handling, you are going to need to purchase the URL Master module from Ifinity. Without this, you are going to have a hard time getting the URLs to work. I am sure it is possible, but I won’t cover that here.

What I ended up doing for the URLs in my conversion was create an HTTPModule that I install into DotNetNuke. I then tell URLMaster which URL formats to ignore and let the HTTPModule handle the redirects for those URLs.

I also converted “blog” posts from CommunityServer into DNNSimpleArticle articles.

CSUrls HTTP Module

I haven’t done an official release for this module, but you can go and grab the source code for the HTTPModule via GitHub.

The HTTPModule is a pretty simple project. Here is the basic overview of what happens in there:

  1. Gets the PortalId
  2. Grabs the incoming URL
  3. Looks for a csdir query string parameter used in SiteURLs.config
  4. Looks for any CS URLs that have a Tags query string (QS) parameter and builds out a link to the DNN Search Results page
  5. Looks for CS URLs that have a PostID QS, and maps them to the corresponding DNN forum thread
  6. Looks for CS URLs that have a ForumID QS, and maps them to the appropriate Forum
  7. Looks for CS URLs that have a GroupID QS, and maps them to the appropriate Forum Group
  8. Looks for CS URLs that have a PostName QS and maps the original CS post ID to the new DNNSimpleArticle ID
  9. Finally, a 301 redirection is performed to send the user to the correct DotNetNuke page.

URLMaster Settings

To get URLMaster configured properly, here are the two settings I configured in Host/Friendly URL:

(useSiteUrlsRegex)

|ShowThread\.aspx|Redirect\.aspx|ShowPost\.aspx|thread/\d+\.aspx|post/\d+\.aspx|ShowForum\.aspx|
/archive/\d{4}/\d{1,2}/\d{1,2}/[a-zA-Z0-9\-\._]*?\.aspx|contact\.php|cgi-bin|forums/rss.aspx

(doNotRedirectRegex)

d+\.aspx|ShowForum\.aspx|/archive/\d{4}/\d{1,2}/\d{1,2}/[a-zA-Z0-9\-\._]*?\.aspx|contact\.php|
cgi-bin|forums/rss.aspx

Redirect.aspx

I created a simple redirect.aspx file in the root of my website with the following contents. This file ensures that if an error occurs, users are redirected to a proper information page.

<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    private void Page_Load(object sender, System.EventArgs e) {
        try { }
        catch {
            string href = "https://www.sccaforums.com/newsite.aspx";
            Response.Status = "301 Moved Permanently";
            Response.RedirectLocation = href;
        }
    }
</script>
<html xmlns="https://www.w3.org/1999/xhtml">
<head runat="server">
    <title>SCCAForums.com</title>
</head>
<body>
    <form id="form1" runat="server">
        <div></div>
    </form>
</body>
</html>

Old URLs and New URLs

Here is an example of how the Forum URLs work in CommunityServer versus DotNetNuke.

Forum Thread Example

  • CS URL: www.sccaforums.com/forums/3/372507/ShowThread.aspx
  • DNN URL: www.sccaforums.com/forums/forumid/25/postid/41008/scope/posts

I intended to provide an example of how the blog urls worked as well, but in testing it looks like at least on SCCAForums.com the old blog URLs no longer work. I’ll have to track down why that is, I am not TOO concerned about it, but probably should be. The reason I am not too concerned, I do know they worked for a long time, and looking around on Google I can’t find any of the old URLs, so basically Google knows the new URLs and points people there. The problem I would run into is any old links for blogs, within existing blog posts, forum threads, or external sites, probably don’t work.

Back to Blog

Related Posts

View All Posts »

Setting up IIRF to redirect to www

Learn how to easily manage URL redirects using IIRF to ensure proper HTTPS and www prefix on your website with this simple rule. #webdevelopment #URLredirects