Enonic Market Enonic Market
Rewrite Manager icon

Rewrite Manager

Rewrite Manager allows you to define rewrite rules to handle request redirects


Note: This application is free for testing but redirects will work only under a valid Enonic license.

Rewrite Manager supports two types of providers to manage rewrite rules:

  • File - configuration file per a virtual host. With this type of provider redirect rules are defined inside the config file.
  • Repository - using this type of provider you can manage redirect rules directly from the application UI. Configuration for each virtual host is stored in the repository called "com.enonic.app.rewrite".

If you are using both types of providers for the same virtual host, then File provider will take precedence.


To configure this application, place a file called "com.enonic.app.rewrite.cfg" inside the configuration directory of your XP instance with the following options:

enabled - this option is used to enable or disable handling the request redirects by application.

includePattern - a RegExp pattern for request URI that should be processed by the application.

excludePattern - a RegExp pattern for request URI that should not be processed by the application.

ruleFileNameTemplate - template of the virtual host configuration filename with rewrite rules.

Default template is com.enonic.app.rewrite.{{vhost}}.conf, where {{vhost}} is a name of a virtual host mapping specified in com.enonic.xp.web.vhost.cfg, for instance, adm.

By default this application is shipped with the following configuration:



Currently the application supports Apache syntax (simplified):


RewriteRule "/oldURL$" "/newURL" [R=301]
RewriteRule "/allUnderThis/(.*)" "/movedToHere/$1" [R=301]
RewriteRule "/kontakt" "/contact" [R=301]
RewriteRule "/avis" "https://rett24.no" [R=302]

If you want to specify a rewrite rule which contains URI-illegal characters, then you have to percent-encode source and target:

RewriteRule "/reparasjon%20og%20vedlikehold%20av%20kj%C3%B8ret%C3%B8y.pdf" "/kj%C3%B8ret%C3%B8y" [R=301]

Currently the application uses the following flags implicitly for each rule:

NE - noescape
L - last
NC - nocase

Note: Changes to configuration files with rewrite rules won't take effect until the Rewrite app is restarted.


  1. 1.1.4

    • Bugfix: Query parameters are removed from target url
    • Compatibility:
      • 7.6.0
  2. 1.1.3

    • Bugfix: Regex substitution does not work in external redirects
    • Compatibility:
      • 7.6.0
  3. 1.1.2

    • Bugfix: Backslash issue on Windows
    • Compatibility:
      • 7.6.0
  4. 1.1.1

    • Fixed license validation
    • Compatibility:
      • 7.6.0
  5. 1.1.0

    • Unified license validation
    • Compatibility:
      • 7.6.0
  6. 1.0.1

    • Fixed deletion of a rule
    • Compatibility:
      • 7.6.0
  7. 1.0.0

    • First Release
    • Compatibility:
      • 7.6.0