301 Redirects

Joel Dahlin asked on March 12, 2014 09:32

I am working on moving a site onto Kentico from php. I am looking for recommendations in how to setup 301 redirects from the legacy urls to their new urls.

ie. mysite.com/about.php should have a 301 redirect point to mysite.com/about

Is this something I would do in the web.config, sitemap, and/or ????

Correct Answer

Brenden Kehren answered on March 12, 2014 13:59

Sent you an email as well but this might work as a "global" solution if you don't want to add aliases to every page.

0 votesVote for this answer Unmark Correct answer

Recent Answers

Yehuda Lando answered on March 12, 2014 14:27

I'm using http://urlrewriter.net/ for the same thing. There are some quirks, which I can't remember exactly at the moment, but you do need to put the old urls in the excluded urls at the URLs and SEO settings page.

0 votesVote for this answer Mark as a Correct answer

Yehuda Lando answered on March 12, 2014 15:25

I can't edit my answer, but what I did was create my own RewriteAction, and in the Execute method, I have this:

var newsId = Regex.Match(context.Location, @"Dev2Go.web\?id=(\d+)&sNewsID=(\d+)").Groups[2].Value;

if (!string.IsNullOrEmpty(newsId))
    var dataSet = TreeHelper.SelectNodes("/כתבות/%", true, "Ativ.Article", string.Format("ArticleID = {0}", newsId));
    var node = dataSet.Tables[0].Rows[0];
    if (node != null)
        context.Location = node["NodeAliasPath"].ToString();
        context.StatusCode = (_permanent ? HttpStatusCode.MovedPermanently : HttpStatusCode.Found);
        return RewriteProcessing.StopProcessing;

return RewriteProcessing.ContinueProcessing;
0 votesVote for this answer Mark as a Correct answer

Filip Ligač answered on March 15, 2014 19:48

Hello Joel,

A few steps have to be done to prepare for such a setup in Kentico:

1) Under Site Manager -> Settings -> URLs and SEO (devnet.kentico.com/docs/7_0/devguide/search_engine_optimization.htm), please enable Allow permanent (301) redirection.

2) In the same settings page, slightly below, please enable Redirect document aliases to main URL setting. Please make sure the settings are correctly inherited in the particular site (and not only in global site scope - the drop-down list in the upper left corner will show what I mean)

3) If the original domain does not point to a running site any longer, you will need to add a domain alias to your site running within Kentico CMS instance (devnet.kentico.com/docs/7_0/devguide/index.html?managing_sites.htm - Domain aliases tab) and configure it to Redirect URL as shown in the example with macro expressions. Do not forget to include the macros shown in the example.

4) The last step you need to do is to add the corresponding document aliases with former alias paths (even those from under different domain) in the new site managed by Kentico CMS: devnet.kentico.com/docs/7_0/devguide/document_properties_urls.htm - Document aliases, explained in more details at devnet.kentico.com/docs/7_0/devguide/multiple_document_aliases.htm

Best regards, Filip Ligac

0 votesVote for this answer Mark as a Correct answer

Heather Williamson answered on May 20, 2016 19:56

If I have multiple base URLS redirecting... sample.com, samplethree.com, etc.. then I need to add the redirects to each document as I load and publish them into the new main site? correct?

Is there a way to do this from a mass upload with an XML document?


0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.