Recently I have been doing a lot of work with my new site and needed to do some consolidation work of my old Blog site to have all of my previous blogs redirected to my new site to allow me to keep the links and rankings that had been accumulated on the old site. My friend Bruce Chapman (B|T) wrote a nice little DNN extension – DNN Url Redirect Provider that is available for download from codeplex.
In this article I am going to take you through the steps you need to follow to utilise this DNN Extension to allow you to redirect any pages you have. Before you go down this track you do need to make sure that your version of DNN web site is 7.1 or later. If you are still working on an earlier version of DNN you will need to go through an upgrade process first. You can confirm your version by going to Host | Host Settings of your site.
First you will need to download the provider from codeplex but make sure you download version 1.01.01 or later so that you have no issues. Now we have the extension we need to install this extension. You will need to log in as Host on your site and navigate to Host | Extensions. From here you can use the Install Extension wizard to install the DNN Url Redirect Provider onto your site.
Once the installation of the Extension has completed you can confirm the provider is enabled for your site by navigating to Admin | Site Settings | Advanced URL Settings and confirm the DNN Url Extension Provider is enabled.
Inside of your SQL Server databases if you run this statement: “Select * from dbo.ExtensionUrlProviders” you should receive 1 row showing the provider is active.
Everywhere in this article where I mention www.newsite.com and www.oldsite.com you will need to swap these for your respective sites you are performing this task for.
Second you will need to go to your server that is running IIS that your website is configured on. Starting IIS Manager and expanding the Sites tree until you can see your site (www.newsite.com). Right click on your site and select edit bindings | Add and add details for the site to be redirected (www.oldsite.com) Click Close
Third you will need to create a new site alias in www.newsite.com. Still logged in as Host navigate to Admin | Site Management | Advanced Settings | Site Aliases Click Add New Alias entering www.oldsite.com and ensure that www.newsite.com stays as your primary site alias.
Fourth you will need to identify the pages from www.oldsite.com that you want to have permanently redirected to www.newsite.com. In my case I was wanting to ensure that all of the blog posts on my old site were going to be permanently redirected to my new site. I had already brought across the blog posts and created them on my new site. With now knowing the pages to be redirected you can create your SQL Server insert statements. Your insert statements will look like this:
Insert Into dbo.urp_redirect ([PortalId] ,[RedirectOrder] ,[HttpAlias] ,[RedirectUrl] ,[MatchType] ,[KeepQueryString] ,[DestTabPath] ,[DestTabId] ,[DestUrl] ,[DestType] ,[IsRegex]) VALUES (0 ,1 ,null ,'/Blog/EntryId/2/BlogTitle2.aspx','relative' ,0 ,null ,null ,'http://www.newsite.com/Blog/Post/371/BlogTitle2.aspx' ,'url' ,0);
The code snippet above will setup the redirection of www.oldsite.com/Blog/EntryId/2/BlogTitle2.aspx to the explicit url – http://www.newsite.com/Blog/EntryId/371/BlogTitle2.aspx
There are other examples of how you can perform these redirects and you can look at them on the codeplex examples.
Fifth step in this process is for you to test the changes and ensure you are happy and that the right page is being redirected to the correct new location. For this you will need to modify your host file to contain the IP Address (of www.newsite.com) and www.oldsite.com. Your host file entry would look something like this:
Before we can perform any tests we need to ensure that we have cleared the cache of www.newsite.com. Once again logged in as Host navigate to Tools | Clear Cache.
Last step before testing the redirection is to perform a restart of www.newsite.com in IIS.
You should now be able to navigate to www.oldsite.com/Blog/EntryID/2/BlogTitle2.aspx and it should be go to www.newsite.com/Blog/Post/371/BlogTitle2.aspx. If everything has gone to plan the only thing left for you to do now is revert your host file entry from step 5 and to change your DNS A records for www.oldsite.com to point at www.newsite.com.
Good luck and hopefully you have found this helpful.