Redirect 'www' to 'non-www' and 'non-www' to 'www' in NodeJs(Express). (example.com to www.example.com or www.example.com to example.com)
🏠 Homepage
- npm >=5.5.0
- node >=9.3.0
npm i www-redirect
const express = require("express");
const redirect = require("www-redirect");
const app = express();
// app.use(redirect(option)); // option = 'www' or option = 'non-www'
// 'www' option for redirecting non-www to www and 'non-www'option for redirecting www to non-www
app.use(redirect("non-www"));
👤 Shubhadeep
- Websites: https://insload.com | https://deepxnet.com
- Twitter: @shubhaX
- GitHub: @deepx-coder
- LinkedIn: @shubha-deep-halder
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
Copyright © 2021 Shubhadeep.
This project is MIT licensed.