Forum Discussion
Most efficient way to search for upper case in [HTTP::uri] or [HTTP::path]
Hi,
My question is mostly in the subject. For SEO reasons, I need to redirect 301 URLs containing any uppercase to the same ones but lowercase (SEO guys complain because they have duplicates).
Something like (I think the one below doesn't work but that's the idea):
when HTTP_REQUEST { if { [HTTP::uri] contains "[A-Z]" } { HTTP::redirect http://[HTTP::host][string tolower [HTTP::uri]] } }
I'm looking for the most efficient way to do this because I'll likely have many 301 to send, at least at the beginning.
Anyone having done such thing or having any advice?
Thanks,
2 Replies
- What_Lies_Bene1
Cirrostratus
I think the most efficient way to do this is to use the matches_glob operand (replacing the 'contains' in your example above). Still, I'm not quite sure how [A-Z] will match any upper-case character.
You could use matches_regex but there's higher overhead I believe. Still, if you can't get the glob to work it might be necessary, I think the regex would look like: [A-Z]+
- Arie
Altostratus
Can't the SEO-guys work with the developers/content folks to use canonical tags? That would probably be the most efficient way to deal with the issue.
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