Forum Discussion
Puneet_73909
Nimbostratus
Mar 03, 2010HTTP Redirect
Hi,
I need help in rediret url.
Whenever user types is http://domain.com/xyz or any uri it should redirect it with 301 redirect.
I have done with HTTP::res...
hoolio
Cirrostratus
Mar 03, 2010Hi Puneet,
I'm not certain I understand what you want to redirect to in the else case, but you can customize it as necessary:
when HTTP_REQUEST {
Check the requested URI set to lowercase
switch -glob [string tolower [HTTP::uri]] {
"/doc.html*" {
URI starts with /doc.html
HTTP::redirect "http://[HTTP::host]/doc.html"
}
"/sitemap.xml" {
URI is exactly /sitemap.xml
pool new
}
default {
No case matched, using default 301 redirect
HTTP::respond 301 Location "http://newurl"
}
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
