The DevCenter has moved!

The Developer Center has a new home, The site you are currently viewing is available as a read-only archive.
Things to note:
  1. Your username & password is the same on the new site,
  2. Going forward, please use the new URL,
  3. The old discussion forums and old KB articles are still available as an archive (read-only)
RSS Feed Print Category View
Aliasing and 301 Redirects
Kyle Heon
Posted: Tuesday, June 16, 2009 11:36 AM
Joined: 12/15/2006
Posts: 84

We are using Ektron v7.61 SP3 and the client has sent over a list of old url's that they want setup as 301 Redirects. In the past we've used an ISAPI filter to handle these redirects but I would much rather not have to install any ISAPI filters and instead would prefer to leverage Ektron's manual aliasing to provide this functionality.

Is there any way to setup aliases with in Ektron and get them to return the proper 301 header so that search engines update their links?

Whatever solution we use, it HAS to support non ASP.NET files as well because the old site was classic ASP.

Kyle Heon
Posted: Wednesday, June 17, 2009 11:18 AM
Joined: 12/15/2006
Posts: 84

Gerson Bothello
Posted: Wednesday, June 17, 2009 1:25 PM
Joined: 2/6/2007
Posts: 18

 URL aliasing currently does not do redirects. However this is possible with a little code behind.


Setup the manual aliases for which you need a redirect to point to a webpage. In the code behind of that page map the URL to do a redirect (301).


Posted: Thursday, April 21, 2011 3:35 PM
Joined: 4/19/2011
Posts: 49

Hi Gerson,


I am trying to redirect the aliased pages using 302 instead of 301. So could you please tell me where to look for the code behind of the pages and also any code snippets!



Posted: Monday, April 25, 2011 8:55 AM
Joined: 4/19/2011
Posts: 49

Hi there,

Any  suggestions or help!



Posted: Tuesday, May 3, 2011 8:46 AM
Joined: 4/19/2011
Posts: 49

Hi Gerson,


I have manual aliasing set up for some pages on my dev and I'm looking at 302 redirect and I would like to know how can we do that from code behind!


Your suggestion is going to help me to save my time and lot of web search.



Posted: Tuesday, May 3, 2011 9:36 AM
Joined: 6/23/2006
Posts: 29

My work around for using alias and redirect is:

  • Create a smart form "Redirect Form" with a textbox for entering the actual URL
  • Create a XSLT which has embeded JS which picks up that URL and handles redirect, apply that XSLT to the "Redirect Form"
  • Apply smart form to a folder "redirect links"
  • Create "Redirect Form" type of content and create alias for that content.

So for example, your actual URL is "", and your URL alias can be "". Then when visitor hits "", the JS will redirect visitor to "" in a blink.

Posted: Monday, June 20, 2011 10:37 AM
Joined: 4/19/2011
Posts: 49

I am able to figure out this issue. Added some code on default.aspx file under sub folder of main site. The new prob. is redirect works on & off (I suspect my caching which stays for 5 min).

Here is the breef desc:

Page: Aboutus.htm has link for content '2200' and this link has been updated to (alias name for content page )

Page: Apply.htm has link for content '2200' which still reads

When I click the link on Apply.htm some times the url for content shows as and some times as

I am pretty sure the code is working partially, but not able to fix this issue.

Here is the code:

Dim strID As Integer
        strID = CInt(Request.QueryString("ID"))
        If ((strID <> 0) and (InStr(1,page.Request.Rawurl,"subfolder/default.aspx?id=") > 0) ) Then
 Dim urlmanual as new UrlAliasManual()
 Dim fullurl as String = string.Empty
 Dim parturl as String = string.Empty
 Dim urlAlias as String = string.Empty
 Dim calias as new Ektron.Cms.UrlAliasing.UrlAliasCommonApi
 'Dim redirecturl as String = string.Empty
 fullurl= page.Request.Url.AbsoluteUri
 'urlAlias = urlmanual.GetDefaultAlias(strid).AliaspageName
 urlAlias= calias.GetAliasForContent(strid)
 if (Len(urlAlias) > 0) Then
 parturl = page.Request.Rawurl
        Response.Redirect(Replace((page.Request.Url.AbsoluteUri),(page.Request.Rawurl),("/"& urlAlias)))
 End If 
 End If

Thanks in advance for any help.

Posted: Friday, February 24, 2012 3:22 PM
Joined: 12/5/2007
Posts: 3


I've approached this with a dB app that looks up the alias. The code resides in the code-behind of my masterpages. If an alias exists, then I build a new URL and pass it along to the proper 301 redirect code. The dB schema is simple: id, alias, redirection, timestamp. I built a simple front end for the marketing folks to add what they wanted to redirect.


Partial Class newcode
    Inherits System.Web.UI.Page


 ' this sub passes the 301 redirection code with the redirection variable included and is

 ' used after it has been determined that an alias exists
    Public Shared Sub create301(ByRef redirection As String)
        HttpContext.Current.Response.Status = "301 Moved Permanently"
        HttpContext.Current.Response.AddHeader("Location", redirection)
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ' the RawURL of where you want to redirect; the baseURL will be added below
         Dim redirection As String = String.Empty
        ' the alias you want to redirect
         Dim pageAlias As String = Request.RawUrl
        'remove the leading / as that is how I've stored it the dB
         pageAlias = pageAlias.Substring(1)

        Using ta As New dsRedirectorsTableAdapters.tbl_snps_redirectsTableAdapter
           ' checks to see if there is a matching alias
         If ta.GetDataByAlias(pageAlias).Rows.Count > 0 Then
                Dim drow As dsRedirectors.tbl_snps_redirectsRow
          ' if the alias exists get the redirector
         Using GetRedir As New dsRedirectorsTableAdapters.tbl_snps_redirectsTableAdapter
            drow = GetRedir.GetDataByAlias(pageAlias).Item(0)
            ' create the full URL by adding the site in front of the redirector
            redirection = "" & drow.redirection
            ' pass the new URL to the sub routine and go there
                End Using
            End If
        End Using

    End Sub

End Class


Mark Cline
Posted: Tuesday, April 3, 2012 10:22 PM
Joined: 6/29/2006
Posts: 87

Another option is to use a custom error page.  We create custom error pages for all of our clients and check the status.  If it is a 404, then we do a lookup (to either a smart form or static xml file that has the old/new links).  If we find the old link, we 301 to the new link.


Bill C.
Posted: Friday, October 12, 2012 5:29 PM
Joined: 6/6/2006
Posts: 692

for others finding this thread on 8.6, keep in mind the Workarea now has a screen for managing this. You can define both 302/303 redirects:




Jump to different Forum...