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

is it possible to suppress question mark from query string?

5+ Year Member

Msg#: 3422795 posted 2:16 pm on Aug 15, 2007 (gmt 0)

Hey guys,

First I would like to thank you guys for this great website, I can't say how many times you helped me in the past!

I finally registered today so I could ask a question:

I know the question mark is not part of the query string, but I would like to know if it could be possible to suppress it using mod_rewrite like in this exemple:


Any input on the subject is greatly appreciated, or maybe some suggestion about what I could do if this is impossible.




5+ Year Member

Msg#: 3422795 posted 4:28 pm on Aug 15, 2007 (gmt 0)

Here is an alternative

If you are posting this url from a form, I think you will only be able to redirect to that location and then rewrite it. Im pretty sure the form requires a?

The way i see it is that you have to do two sets of rules to accomplish what you want

1. Redirect from http://www.example.com/?search=need+for+speed to http://www.example.com/search/need+for+speed/ (I changed this becuase i think its better)

2. Rewrite to your internal script to catch the "search" variable from the URL

Here is how I would do it:

#Redirect from form to page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?search=(.*)\ HTTP/ [NC]
RewriteRule ^$ http://www.example.com/search/%1/? [R=301,L]

#Redirect underlying url

RewriteRule ^/?search/([a-zA-Z0-9_\+]+)/?$?search=$1 [NC]

There might be a few bits wrong here and there, but it should get you on the right track.

After this, you will need to rewrite the links in your menus on pages etc. to reflect the new /search/need+for+speed/ logic


[edited by: Zacharias at 4:33 pm (utc) on Aug. 15, 2007]

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