Forum Discussion

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

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
http://www.domain.com/something -> https://www.domain.com/something

is that just with one redirect possible would be nice (google ranking) any ideas?

  • 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]"
                }
           }
    }
    

2 Replies

  • 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]"
                }
           }
    }