www-redirect

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)

Usage no npm install needed!

<script type="module">
  import wwwRedirect from 'https://cdn.skypack.dev/www-redirect';
</script>

README

Welcome to www-redirect 👋

Version Documentation Maintenance License: MIT Twitter: shubhaX

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

Prerequisites

  • npm >=5.5.0
  • node >=9.3.0

Install

npm i www-redirect

Usage

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")); 

Author

👤 Shubhadeep

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2021 Shubhadeep.
This project is MIT licensed.