Forum Discussion

CSA's avatar
CSA
Icon for Nimbostratus rankNimbostratus
May 12, 2014

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

  • 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's avatar
    Arie
    Icon for Altostratus rankAltostratus

    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.