Redirect with Global Options

  0 rating
5/24/2019 5:35:59 PM
10/7/2019 8:05:54 PM
Source: GitHub Source
Provider: Vikash Raaj

About

Why Sitecore Redirect With Global Option

Normally Sitecore doesn’t support the redirects via content, we either we need to add the hardcoded config file or write our own solution to it otherwise we need to use SXA which has redirect module, but still https & www redirect is not available for site specific and it’s a configuration file we maintain.

When we add additional sites, then we want to disable the https & www for particular site, then we need to add rules in config for redirect to avoid, again this makes the instance restart.

This plugin provides the solution to the problem.

Options in Sitecore Redirect with Global Option Plugin

Reusability across Site & Multi Site

When there is a need to reuse the same redirect options, it can be shared across sites.

Core Redirect

Https Redirect

                If we want to have https redirect enabled, yes we have the option to enable and disable whenever required.

www redirect

                If we want to have www redirect enabled, yes we have the option to enable and disable whenever required. à mysite.com can be redirected to www.mysite.com always when enabled.

Internal or External Redirect

                If we want to redirect to some other page instead of current page item.

                Multiple redirect files can be created and grouped out as we need to do.

Raw Redirect

                We have another option for redirect type and enable query string preservations or disabled as per the need. Also the source and destination items can be direct raw URL or a regex pattern is supported always.

How to Install

                Installation of the package is very simple, just you need to have the Sitecore 9.0 & above installed.

  • Download the package
  • Go to install package manage wizard
  • Upload and install the package
  • By default the package would be installed in
    • Master DB: SitecoreàSystem à modules folder and template are under Templatesàfeatures
    • Core DB: new name value list data type to handle regex pattern.

How to Use the Plugin

                Go to  SitecoreàSystemàModulesàredirects and right click redirect, it will ask valid name for the item to create, provide a valid name and click ok.

                Sitecore will create a set of items under redirects folder for each item that we create, which has all the set of rules and configuration it contains.

                Now we need to add additional attribute (redirectSettingsId with value as the item that we have created under redirects folder.) in Site definition for the site that needs this rule to run.

<site name="website1" hostName=”www.google.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/site1" startItem="/home " database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false"  redirectSettingsId=”{asdsad-asdsad-asdsadsa-asdsad-}”/>

Now this configurations would load for the site and store in cache until we make any changes to the redirect items.

Why Cache is Used

                To minimize the item read operation, we do store the redirect information’s in cache and reuse with the specified expiration time and this is also configurable in the config file placed in

                <sitecore-website-Folder>/app_config/include/redirects/Sitecore.Feature.Redirects.config

Future Enhancements

                Add the Sitecore 9 feature of roles and environment and provide a multi combination based redirect which works dynamically for same site entry but different in each environment and instance role.


Documentation

Documentation
  • Documentation > Document on Sitecore Redirect with Global Options
    Document on Sitecore Redirect with Global Options

    Why Sitecore Redirect With Global Option 

    Normally Sitecore doesn’t support the redirects via content, we either we need to add the hardcoded config file or write our own solution to it otherwise we need to use SXA which has redirect module, but still https & www redirect is not available for site specific and it’s a configuration file we maintain.

    When we add additional sites, then we want to disable the https & www for particular site, then we need to add rules in config for redirect to avoid, again this makes the instance restart.

    This plugin provides the solution to the problem.

    Options in Sitecore Redirect with Global Option Plugin

    Reusability across Site & Multi Site

    When there is a need to reuse the same redirect options, it can be shared across sites.

    Core Redirect

    Https Redirect

                    If we want to have https redirect enabled, yes we have the option to enable and disable whenever required.

    www redirect

                    If we want to have www redirect enabled, yes we have the option to enable and disable whenever required. à mysite.com can be redirected to www.mysite.com always when enabled.

    Internal or External Redirect

                    If we want to redirect to some other page instead of current page item.

                    Multiple redirect files can be created and grouped out as we need to do.

    Raw Redirect

                    We have another option for redirect type and enable query string preservations or disabled as per the need. Also the source and destination items can be direct raw URL or a regex pattern is supported always.

    How to Install

                    Installation of the package is very simple, just you need to have the Sitecore 9.0 & above installed.

    • Download the package
    • Go to install package manage wizard
    • Upload and install the package
    • By default the package would be installed in
      • Master DB: SitecoreàSystem à modules folder and template are under Templatesàfeatures
      • Core DB: new name value list data type to handle regex pattern.

    How to Use the Plugin

                    Go to  SitecoreàSystemàModulesàredirects and right click redirect, it will ask valid name for the item to create, provide a valid name and click ok.

                    Sitecore will create a set of items under redirects folder for each item that we create, which has all the set of rules and configuration it contains.

                    Now we need to add additional attribute (redirectSettingsId with value as the item that we have created under redirects folder.) in Site definition for the site that needs this rule to run.

    <site name="website1" hostName=”www.google.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/site1" startItem="/home " database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false"  redirectSettingsId=”{asdsad-asdsad-asdsadsa-asdsad-}”/>

    Now this configurations would load for the site and store in cache until we make any changes to the redirect items.

    Why Cache is Used

                    To minimize the item read operation, we do store the redirect information’s in cache and reuse with the specified expiration time and this is also configurable in the config file placed in

                    <sitecore-website-Folder>/app_config/include/redirects/Sitecore.Feature.Redirects.config

    Future Enhancements

                    Add the Sitecore 9 feature of roles and environment and provide a multi combination based redirect which works dynamically for same site entry but different in each environment and instance role.


    0
Back
Release notes
Please insert section here whenever you add a new version of your Sitecore module package describing version number, new features, fixes and possible known issues.
Read more Back
Code examples

Solution screenshots(0)

Upload

Reviews (0)

Sort by: Date Most votes
  • Profile Avatar
    [fullName]

    Level: 0

    x0 x0 x0

    [date]

    [title]

    [text]

    Was this helpful?

    0

Comments (0)

Sort by: Date  Most votes

Leave a Comment

Comment must be field in
Post comment
loader

Write a review

Title can't be empty
Review can't be empty
Post review

Download

Title Description Download Action

Add File