Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Search a word in query string

htaccess help

10:13 am on Jul 11, 2011 (gmt 0)

Full Member

10+ Year Member

joined:Aug 22, 2005
posts: 324
votes: 0

Hi all,

I have been trying to fine "+" sign in my query string. for example if someone types example.com/test+love then it needs to be redirected to testcond.php

So I wanted to check if query string has plus sign in it or not? if no plus sign then it will not run that file.

i tried

RewriteCond %{QUERY_STRING} ^([+])$
RewriteRule ^([a-zA-Z\+]+)$ testcond.php?keyword=$1 [L]

but it didnt work. I just need to check if plus sign "+" is there in query, if plus sign is there only then testcond.php file should run.

Please help me.
3:57 pm on July 11, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
votes: 598

RewriteCond %{QUERY_STRING} ^([+])$
but it didnt work.

No, I don't suppose you will get many query strings that consist entirely of a single plus sign. What you have is equivalent to
(beginning anchor, one character, ending anchor). Neither that capturing ( ) nor the grouping [ ] is relevant.