Rewrite Manager
Rewrite Manager allows you to define rewrite rules to handle request redirects
Screenshots
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.
Configuration
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:
enabled=false
excludePattern=^/admin/.*|.*/_/asset/.*|.*/_/image/.*
includePattern=^/site/.*
ruleFileNameTemplate=com.enonic.app.rewrite.{{vhost}}.conf
Usage
Currently the application supports Apache syntax (simplified):
com.enonic.app.rewrite.myvhost.conf
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.
Releases
1.0.0
- First Release
Compatibility:
- 7.6.0
Get Rewrite Manager application
This version requires XP 6.15.0
To install and run this app, you will need a running instance of Enonic XP. The app can be installed in several ways:
Using XP Admin
Applications from Enonic Market can be installed directly from the "Applications" app in Enonic XP.
OR
Using CLI
Run the following command:
$
This command installs an application on all nodes. Remember to replace <username> and <password> with your admin login credentials.
Using Toolbox
OSX/Linux
Windows
The install-app tool installs an application on all nodes. Remember to replace <username> and <password> with your admin login credentials.
Download JAR
Download Rewrite Manager v1.0.0Get 5 days free hosted version of "Rewrite Manager" application for Enonic XP.