func NonWWWRedirect() echo.MiddlewareFunc {
	return NonWWWRedirectWithConfig(DefaultRedirectConfig)
}
NonWWWRedirect redirects www requests to non www.
For example, http://www.labstack.com will be redirect to http://labstack.com.

Usage `Echo#Pre(NonWWWRedirect())`
package middleware
import (
	"net/http"
	"github.com/labstack/echo"
)
type (
	RedirectConfig struct {
		Skipper Skipper
		Code int `json:"code"`
	}
)
const (
	www = "www"
)
var (
	DefaultRedirectConfig = RedirectConfig{
		Skipper: DefaultSkipper,
		Code:    http.StatusMovedPermanently,
	}
)
func HTTPSRedirect() echo.MiddlewareFunc {
	return HTTPSRedirectWithConfig(DefaultRedirectConfig)
}
func HTTPSRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc {
	if config.Skipper == nil {
		config.Skipper = DefaultTrailingSlashConfig.Skipper
	}
	if config.Code == 0 {
		config.Code = DefaultRedirectConfig.Code
	}
	return func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(c echo.Context) error {
			if config.Skipper(c) {
				return next(c)
			}
			req := c.Request()
			host := req.Host
			uri := req.RequestURI
			if !c.IsTLS() {
				return c.Redirect(config.Code, "https://"+host+uri)
			}
			return next(c)
		}
	}
}
func HTTPSWWWRedirect() echo.MiddlewareFunc {
	return HTTPSWWWRedirectWithConfig(DefaultRedirectConfig)
}
func HTTPSWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc {
	if config.Skipper == nil {
		config.Skipper = DefaultTrailingSlashConfig.Skipper
	}
	if config.Code == 0 {
		config.Code = DefaultRedirectConfig.Code
	}
	return func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(c echo.Context) error {
			if config.Skipper(c) {
				return next(c)
			}
			req := c.Request()
			host := req.Host
			uri := req.RequestURI
			if !c.IsTLS() && host[:3] != www {
				return c.Redirect(config.Code, "https://www."+host+uri)
			}
			return next(c)
		}
	}
}
func HTTPSNonWWWRedirect() echo.MiddlewareFunc {
	return HTTPSNonWWWRedirectWithConfig(DefaultRedirectConfig)
}
func HTTPSNonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc {
	if config.Skipper == nil {
		config.Skipper = DefaultTrailingSlashConfig.Skipper
	}
	if config.Code == 0 {
		config.Code = DefaultRedirectConfig.Code
	}
	return func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(c echo.Context) error {
			if config.Skipper(c) {
				return next(c)
			}
			req := c.Request()
			host := req.Host
			uri := req.RequestURI
			if !c.IsTLS() {
				if host[:3] == www {
					return c.Redirect(config.Code, "https://"+host[4:]+uri)
				}
				return c.Redirect(config.Code, "https://"+host+uri)
			}
			return next(c)
		}
	}
}
func WWWRedirect() echo.MiddlewareFunc {
	return WWWRedirectWithConfig(DefaultRedirectConfig)
}
func WWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc {
	if config.Skipper == nil {
		config.Skipper = DefaultTrailingSlashConfig.Skipper
	}
	if config.Code == 0 {
		config.Code = DefaultRedirectConfig.Code
	}
	return func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(c echo.Context) error {
			if config.Skipper(c) {
				return next(c)
			}
			req := c.Request()
			scheme := c.Scheme()
			host := req.Host
			if host[:3] != www {
				uri := req.RequestURI
				return c.Redirect(config.Code, scheme+"://www."+host+uri)
			}
			return next(c)
		}
	}
}