Page is a not externally linkable
lucy24 - 7:32 am on Sep 23, 2012 (gmt 0)
such static URL is most likely invalid, too: it would result in Apache trying to serve the part of the URL before the "+" as a file/directory name
This looked promising at first glance, but it turns out not to work; see below. (I did some more experimenting after I hit Submit, so I hope you don't read too fast :))
In any case I'm not wildly thrilled about the current form
%{THE_REQUEST} \+.*search\.htm
It will work, but it's not optimal. Constructions with non-final .* or .+ are never a good idea. The Regular Expression will find a plus and then whizz along all the way to the end of its search string-- in this case the whole request-- before screeching to a halt: "Oh, oops, I was supposed to leave room for a 'search.htm'". This isn't even the very end of the request; the search should have been stopped sooner. At an absolute minimum, constrain it to \S non-spaces.
Does your site use query strings that might contain plusses? Do you have a real page whose name ends in "search.htm"? If not, all you need is a bare \+ in the Condition.
given /word1+word2-search.htm it still 301 redirects to /word1 , then sends 404
I don't get where the redirect is coming from. I tried some random requests containing plusses (don't be alarmed, webmaster, that was just me experimenting) on various domains including my own, and nothing extra happened. I got taken straight to the 404 page. So if you're getting redirected, there's code in place somewhere that's explicitly causing it to happen. Even if the plusses were converted to spaces-- which they aren't, in the body of an URL-- the request wouldn't be truncated. You can use spaces; they just don't travel well.