Forum Discussion

amebiz_142234's avatar
amebiz_142234
Icon for Nimbostratus rankNimbostratus
Mar 14, 2018

protocol and sub domain redirect

hi guys, i want to redirect like that: http://domain.com -> https://www.domain.com http://domain.com/something -> https://www.domain.com/something http://www.domain.com -> https://www.domain.com h...
  • Darren_Walker_2's avatar
    Mar 14, 2018

    I don't know if this is the most straightforward way of doing it or not but I hope this works for you:

    when HTTP_REQUEST { 
        switch [HTTP::host] {
            domain.com {
                HTTP::redirect "https://www.domain.com[HTTP::uri]"
                }
            www.domain.com {
                HTTP::redirect "https://www.domain.com[HTTP::uri]"
                }
           }
    }