go-aah / aah

A secure, flexible, rapid Go web framework
https://aahframework.org
MIT License
691 stars 33 forks source link

Add OOTB support www->non-www and vice-versa #177

Closed jeevatkm closed 6 years ago

jeevatkm commented 6 years ago

Goal is to add OOTB support for server redirects.

Configuration goes under section server { ... }

# Server redirects configuration (www => non-www, vice versa), its applicable
# to all domains/subdomains configured in `routes.conf`
#
# Note: Its applicable to hostname only not protocol. For `http => https`
# refer to config section `server.ssl.redirect_http`.
redirect {
  # Enabling redirects.
  # Default value is `false`.
  enable = true

  # Possible values are
  #   - `www`     - aahframework.org      => www.aahframework.org
  #   - `non-www` - www.aahframework.org  => aahframework.org
  # Default value is `non-www`.
  #to = "www"

  # Redirect code.
  # Default value is 301 MovedPermanently RFC 7231.
  #code = 301
}
jeevatkm commented 6 years ago

Completed, available on edge.