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::respond 301 location and it works.
But need help in writting an iRule where user types in any URI saying xyz or abc or anything which we don't know then it redirect with 301 response code.
NEED URGENT HELP!!!!!
Thanks,
Puneet
- hoolio
Cirrostratus
Hi Puneet,when HTTP_REQUEST { Send 301 redirect to https with host and URI preserved HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri]" }
- Puneet_73909
Nimbostratus
Thanks for your quick reply.. - hoolio
Cirrostratus
Hi Puneet,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" } } }
- Puneet_73909
Nimbostratus
Thanks!!! - hoolio
Cirrostratus
That's pretty much it. A user would have to type in /doc.html followed by anything in order to get redirected for the first case. - lmwf1_55268
Nimbostratus
Puneet,
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