connect-url-rewrite

Connect/Express middleware for rewriting URLs using regular expressions (like mod_rewrite).

npm install connect-url-rewrite
13 downloads in the last day
43 downloads in the last week
152 downloads in the last month

Connect/Express URL Redirect Middleware

Connect/Express middleware for rewriting URLs using regular expressions (like mod_rewrite).

Usage


// Require the middleware
rewrite = require("connect-url-rewrite");

// Build your redirect rules
rules = [
  "^\/example.html /redirected.html"
]

// Add the middleware to the stack
app.use(rewrite(rules));
npm loves you