homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Search a word in query string
htaccess help

5+ Year Member

Msg#: 4337890 posted 10:13 am on Jul 11, 2011 (gmt 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.



WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

Msg#: 4337890 posted 3:57 pm on Jul 11, 2011 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved