URL Redirection

   —   

The URL redirection module helps you to preserve old URLs while migrating from another system/site to Kentico.

This module covers just basic functionality and it's a proof of concept that hasn't been tested for every scenario. If it's not working as you need, feel free to fix it (\App_Code\CMSModules\URLRedirection).

If you have you web site on some older platform, you may noticed your URL links end like this:

/product.php?id=1

The problem is that the product target page has just one path (product.php) and particular products get loaded just according to the id query string and as you probably know, you can’t specify page aliases in Kentico to contain query strings.

The recommended approach in this case is to create URL rewrite rules on your IIS server since the server handles the request as the first layer. If you want to make this approach to by more dynamic, you can follow this webinar made by one of our solution architects to combine page aliases and redirections from a custom table and pass them to the IIS as URL rewrite rules.

However, if you don’t count every millisecond during your page load, you can import the module below and you will have simple UI interface for configuring 301 and 302 redirects from your old URLs to Kentico new ones.

Import downloaded package to your Kentico 8.2 - 10.0 or this package to your Kentico 11.0 or newer and do not forget to check the Import files (recommended) checkbox and then the Import code files checkbox in Step 2 of the importing process:

Once the package is imported (it can take a while since the site needs to be recompiled), edit your site and add the URL Redirection module to it (Sites -> site -> Assigned objects -> Modules). After this a new application should appear in your application list under the Custom section:

The redirection URLs enter in format of paths from the root of your content tree (also known as node alias paths):

If your old URLs have different extension than aspx (e.g. php), edit your web.config file and set the runAllManagedModulesForAllRequests attribute to true for the opening <modules> tag:

<system.webServer>
  ...
  <modules runAllManagedModulesForAllRequests="true">
    ...
  </modules>
...
</system.webServer>

 

Share this article on   LinkedIn

Jan Hermann

I am a support engineer in Kentico and I take care of any issue you have!