Forum Discussion
Shay_Ben-David1
Nimbostratus
Jun 25, 2007http code 301&302
when using irule to redirect example: "HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri] "
i can see in the client that i get HTTP code 302 that means redirects, is there a way to get Permanent Redirect with HTTP 301 ?
thanks
- hoolio
Cirrostratus
Hi Shay,HTTP::respond [content ] [ ]+
HTTP::respond 301 Location "https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
- Wil_Schultz_101
Nimbostratus
Here are a couple of examples:This will take requests for mydomain.com/$uri and 301 to www.mydomain.com/$uri switch -glob [string tolower [HTTP::host]] { "mydomain.com" { HTTP::respond 301 \ "Location" "http://www.mydomain.com[HTTP::uri] " \ "Server" "www.mydomain.com" } } This will 301 everone trying to access the /admin utilities to the homepage switch -glob [string tolower [HTTP::uri]] { "/admin/*" { HTTP::respond 301 \ "Location" "http://www.mydomain.com" \ "Server" "www.mydomain.com" } }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects