I'm trying to redirect all addresses which contain at least one capital character.
开发者_StackOverflow社区i.e:
dont rewrite - cities/nashville , but rewrite - cities/Nashville.
You can use the NC flag to ignore the case for the pattern matching:
RewriteRule ^jewelry-stores/nashville$ /jewelry/cities/nashville [L,R=301,NE]
Otherwise, if you want to test for at least one capital letter, use [A-Z]
:
RewriteRule ^jewelry-stores/([^A-Z]*[A-Z].*) /jewelry/cities/${tolower:$1} [L,R=301]
Additionally the internal mapping function tolower is used to turn the matched string into lowercase. (Note that RewriteMap
requires access to the server or virtual host configuration.)
something like
RewriteRule ^citites/.*[A-Z].*$ /whatever [L,R=301]
should work as expected
精彩评论