How to rewrite domain.com/?q=blabla

Discussion in 'Apache' started by 993ti, Jul 21, 2009.

  1. #1
    I'm trying to rewrite a couple of urls that look like this:
    domain.com/?q=blabla&click=start
    domain.com/?q=blabla+blabla2&click=start

    I want them to redirect to domain.com/search/blabla
    I tried ^?q=blabla http://www.domain.com/search/blabla [R=301,L] but that will show a 500 error.
    Also tried
    ^\?q=blabla http://www.domain.com/search/blabla [R=301,L]
    I tried some results on Google but didn't work.
    I have no idea how to get this to work, i did see lots of ideas and suggestions with urls that have the question mark after index.php for example but none where the question mark starts right after the /

    Any htaccess pros who know how to tackle this one?
    Thanks in advance
     
    993ti, Jul 21, 2009 IP
  2. gostats

    gostats Peon

    Messages:
    325
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this one: (just off the top of my head)
    
    RewriteRule ^search/([^/\.]+)/?$ ?q=$1&click=start [R=301,L]
    
    Code (markup):
     
    Last edited: Jul 24, 2009
    gostats, Jul 24, 2009 IP