Forum Discussion
Stacy_Lanier_53
Nimbostratus
Jul 28, 2008301 Redirect
I am trying to throw a URL redirect for a specific UserAgents in a file when a specific URL is entered by the user.
when HTTP_REQUEST {
if { ([matchclass [HTTP::header value User-Agent] equals $::user_agents]) and \
[HTTP::uri] equals "http://internalURL/www.craigslist.org"}
HTTP::respond 301 Location "http://www.craigslist.org[HTTP::uri]"
}
Can anyone see what I am doing wrong?
Thanks
- Nicolas_Menant
Employee
Hi,when HTTP_REQUEST { if { ([matchclass [string tolower [[HTTP::header value User-Agent]] equals $::user_agents]) and ([string tolower[HTTP::uri]] equals "http://internalurl/www.craigslist.org")} { HTTP::respond 301 Location "http://www.craigslist.org[HTTP::uri]" }
- Stacy_Lanier_53
Nimbostratus
I am getting the following error now if you might know what's wrong. - Nicolas_Menant
Employee
My Mistake it misses a closing bracewhen HTTP_REQUEST { if { ([matchclass [string tolower [HTTP::header value User-Agent]] equals $::user_agents]) and ([string tolower[HTTP::uri]] equals "http://internalurl/www.craigslist.org")} { log local0. "Match done" HTTP::respond 301 Location "http://www.craigslist.org[HTTP::uri]" } }
- Nicolas_Menant
Employee
Code updated again - Stacy_Lanier_53
Nimbostratus
I appreciate your help and got one more error - Nicolas_Menant
Employee
Hi,when HTTP_REQUEST { if { ([matchclass [string tolower [HTTP::header "User-Agent"]] equals $::user_agents]) and ([string tolower [HTTP::uri]] equals "http://internalurl/www.craigslist.org")} { log local0. "Match done" HTTP::respond 301 Location "http://www.craigslist.org[HTTP::uri]" } }
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