How to always set “www” in grailsUrl?

 

To always set “www” in grailsUrl, we have to create filter. Following is the example :

class HostFilters {

def filters = {
all(controller:’*’, action:’*’) {
before = {
if(request.getHeader(“host”) ==”changeme.com” ){

redirect(url: “http://www.changeme.com”)

}
}

}
}


ProsperaSoft offers Grails development solutions. You can email at info@prosperasoft.com to get in touch with ProsperaSoft Grails experts and consultants.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>