title: Rewrite Plugin keywords: [“rewrite”] description: rewrite plugin
1. Overview
1.1 Plugin Name
1.2 Appropriate Scenario
- The request uri can be different from the target service by rewriting the path.
1.3 Plugin functionality
- This plugin is used to rewrite the request uri.
1.4 Plugin code
1.5 Added Since Which shenyu version
2. How to use plugin
2.1 Plugin-use procedure chart
![](data:image/gif;base64,zSoyz)
2.2 Import pom
- Import maven config in shenyu-bootstrap project's
pom.xml
file..
<dependency>
<groupId>org.apache.shenyu</groupId>
<artifactId>shenyu-spring-boot-starter-plugin-rewrite</artifactId>
<version>${project.version}</version>
</dependency>
2.3 Enable plugin
- In
shenyu-admin
--> BasicConfig --> Plugin --> rewrite
set Status enabled. ![](data:image/gif;base64,zSoyz)
2.4 Config plugin
2.4.1 Plugin Config
- Enable the plugin before using.
- Disable the plugin if don't use.
2.4.2 Selector Config
2.4.3 Rule Config
![](data:image/gif;base64,zSoyz)
- Param details:
regex
: The regular expression that matches the part of uri to be rewrited.replace
: The content of replacement.
2.5 Examples
2.5.1 Example for rewriting uri
2.5.1.1 Run the shenyu-examples-http project
2.5.1.1 Plugin Config
- Refer to 2.4.1 to configure plugin.
2.5.1.2 Selector Config
- Refer to 2.4.2 to configure selector
2.5.1.3 Rule Config
![](data:image/gif;base64,zSoyz)
The request /http/hello
would be rewrited to /hi
2.5.1.4 Check Result
Use some tool (such as Postman) to make a request:
![](data:image/gif;base64,zSoyz)
3. How to disable plugin
- In
shenyu-admin
--> BasicConfig --> Plugin --> rewrite
set Status disable.