Forum Discussion
301 redirect
HI,
I need to get a specific uri that is giving a 302 redirect to respond with a 301:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/x648.html" } { HTTP::respond 301 Location [string map -nocase {"/x648.html" "/LegacyPublications"} [HTTP::uri]] } }
No matter what I try I get don't get the 301 redirect.
Thanks for the help
2 Replies
Hi!
Have you tried some debug logging? Check if the if statement is triggered by issuing this within the if statement:
Log local0. "Triggered for [HTTP::uri]"
I would also log your string map to verify the output.
/Patrik
- IheartF5_45022
Nacreous
The Location header should be absolute ie
Location "http://[HTTP::host][string map -nocase {"/x648.html" "/LegacyPublications"} [HTTP::uri]]"I can't say for sure if this is your problem, but a relative one will not work for all browsers AFAIK.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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