Retaining Query String Parameters and Values in the URL

Overview

DNN converts the query strings in the URLs by default. The only parameter in the query string that remains as such is the UTM_parameter. Users may want to avoid their query strings being converted. This article provides information on how to retain a query string parameter and value in the URL. It also details how to apply this setting globally in Evoq 9.2.2. 

 


 

Process

The reason why the UTM query strings are not rewritten is that they are included in the Keep in Querystring Regular Expression section in the AUM (Advanced URL Management). If you would like a specific query string not to be converted into paths, please follow the procedure below:
 

  1. Navigate to Settings > SEO.
     
    image.png
     
  2. Go to URL Management > Expressions.
     
    image__1_.png
     
  3. Add the query for which you would like to avoid the conversion in the Keep in Querystring Regular Expression section.
     
    image__2_.png
     
    By default, the Keep in Querystring Regular Expression section contains the following:
     
    /nomo/\d+|/runningDefault/[^/]+|/popup/(?:true|false)|/(?:page|category|sort|tags)/[^/]+|tou/[^/]+|(/utm[^/]+/[^/]+)+

    For example, if you want to retain the test-source query parameter, the Keep in Querystring Regular Expression section should be as follows:
     
    /nomo/\d+|/runningDefault/[^/]+|/popup/(?:true|false)|/(?:page|category|sort|tags)/[^/]+|tou/[^/]+|(/utm[^/]+/[^/]+)+|/test-source/
      
  4. Click Save

    mceclip0.png
     
  5. Clear your browser's cache, and try to load it again.
     
    For the test-source example, the link is https://evoq-dev.com/?test-source=Test.

 

Back to top


 

Supplemental Information

The Keep in Querystring Regular Expression field has a global icon setting. In other words, this setting is a host setting and is applied to all sites in the installation. However, there is a bug in Evoq 9.2.2 that causes it to use the Portal setting instead of the Host setting. If you are using Evoq 9.2.2, to make this setting work globally, follow one of the options below:

  • Upgrade to Evoq 9.3.0.
     
    1. Download the relevant Evoq upgrade package.
    2. Follow the instructions in this article on Upgrading Evoq.
       
  • Manually insert the setting into the HostSettings table, and remove the configuration from the PortalSettings table.
     
    1. Go to Settings > SQL Console.
    2. Edit the HostSettings table by executing the command below:
       
      IF NOT EXISTS (SELECT * 
                     FROM   hostsettings 
                     WHERE  settingname = 'AUM_KeepInQueryStringRegex') 
        BEGIN 
            INSERT INTO hostsettings 
                        (settingname, 
                         settingvalue, 
                         settingissecure, 
                         createdbyuserid, 
                         createdondate, 
                         lastmodifiedbyuserid, 
                         lastmodifiedondate) 
            VALUES      ('AUM_KeepInQueryStringRegex', 
      '/nomo/\d+|/runningDefault/[^/]+|/popup/(?:true|false)|/(?:page|category|sort|tags)/[^/]+|tou/[^/]+|(/utm[^/]+/[^/]+)+|/test-source/' 
                   , 
      0, 
      -1, 
      '<Enter Date>', 
      1, 
      '<Enter Date>'); 
      END 
       
    3. Delete the Portal specific setting and force the application to use the global value by executing the following command:
       
      DELETE FROM portalsettings 
      WHERE  settingname = 'AUM_KeepInQueryStringRegex' 

 

Back to top


 

Confirmation

When you go to the URL again, the query string persists.

 

Back to top


 

Comments

0 comments

Please sign in to leave a comment.