Skip to content

expressNakedRedirect is a middleware for Express that redirects naked(root domain) request to www or its reverse.

License

Notifications You must be signed in to change notification settings

gorkemyontem/express-naked-redirect

 
 

Repository files navigation

express-naked-redirect

NPM Version NPM Downloads Dependency Status Linux Build Windows Build

expressNakedRedirect is a middleware for Express that redirects naked(root domain) request to www or its reverse.

Installation

$ npm install express-naked-redirect --save

Features

  • Redirect naked(root domain, non-www) request to www.
  • Redirect www request to naked(root domain, non-www).
  • Redirect naked(root domain, non-www) request to specific subdomain.
  • Redirect specific subdomain request to naked(root domain, non-www).

Usage

Redirect naked to www

It allows you to redirect http://domain.tld to http://www.domain.tld

app.use(require('express-naked-redirect')())

Redirect www to naked

It allows you to redirect http://www.domain.tld to http://domain.tld

app.use(require('express-naked-redirect')(true))

Redirect naked to specific subdomain

It allows you to redirect http://domain.tld to http://sub.domain.tld

app.use(require('express-naked-redirect')('sub'))

Redirect specific subdomain to naked

It allows you to redirect http://sub.domain.tld to http://domain.tld

app.use(require('express-naked-redirect')(true, 'sub'))

License

MIT License

Author

GONZO (oss@dp.farm)

About

expressNakedRedirect is a middleware for Express that redirects naked(root domain) request to www or its reverse.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%