Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Root domain redirect that ignores uris

Dave_Pisarek
Cirrus
Cirrus

I have an interesting ask and I am guessing this has been asked before but not finding an answer. A customer wants to protect a root domain page by not allowing clients to connect to it but does not want to effect traffic to the uris.

 

Example:

 

Redirect traffic to jobs.com to hired.com.

Allow traffic to jobs.com/search or jobs.com/rehired, they have thousands of uris so can't just specify the uris in the rule.

 

Doing a simple equals redirects all uris to the hired.com.

 

when HTTP_REQUEST {

  if {[HTTP::host] eq "jobs.com"} {

    HTTP::redirect "https://hired.com"

}

}

 

How can we specify to allow anything after the jobs.com/* to be allowed but redirect the root?

 

1 REPLY 1

SanjayP
MVP
MVP

Yes, this has been answered many times. You can use something like below.

when HTTP_REQUEST {
   if {[HTTP::uri] equals "/"} {
        HTTP::respond 301 Location "https://hired.com"
        return
   } 
}

Please note, this would need modification if you have any further custom requirement.