Regex Trouble

Discussion in 'PHP' started by vjeleven, Aug 22, 2008.

  1. #1
    Hi,

    I think this is a rather simple thing to solve, but I've been unable to do it so far !!

    I have several redirect rules set up in my .htaccess (most of them involving regex), but I am unable to get the following one working:

    1. I need to be able to redirect all requests coming to ".../?n=X" to "http://mysite.com/names/X" - I am unable to match the "\?n=*" part using regex!

    Can somebody please help me.

    Any help will be of great value to me. Thanks in advance.
     
    vjeleven, Aug 22, 2008 IP
  2. William[ws]

    William[ws] Peon

    Messages:
    47
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteRule ^\?n=(.*) http://mysite.com/names/$1 [L]

    try that ..
     
    William[ws], Aug 22, 2008 IP