.htaccess help needed

Discussion in 'General Scripting Chat' started by matt_k, Nov 12, 2010.

  1. matt_k

    matt_k Registered Member

    Joined:
    Mar 14, 2010
    Messages:
    65
    Likes Received:
    52
    I am trying to read all characters after .com/ and mod_rewrite them as a single variable that i can use php to $_GET['']. This is what I have so far.

    Code:
    RewriteEngine on
    RewriteBase /
    
    RewriteRule ^(.*)$ index.php?user=$1 [qsa]
    This works great except it doesnt allow me to read '?' characters. I have a feeling that I need the htaccess file to read the entire url (or after .com/) and encode all characters so it is URL safe.

    does anyone know how to do that with htaccess?



    examples

    with the above htaccess, if i goto
    www.mydomain.com/testing/this/htaccess/

    the $_GET['user'] will = 'testing/this/htaccess/'

    however, if i goto this url
    www.mydomain.com/testing/this/?htaccess/

    the $_GET['user'] will = 'testing/this/'

    is there a way i can have htaccess read all characters, or convert the ?'s to encoded_url chars?
     
    Last edited: Nov 12, 2010
  2. matt_k

    matt_k Registered Member

    Joined:
    Mar 14, 2010
    Messages:
    65
    Likes Received:
    52
    I have a walk around that i can do with php while still using the same htaccess code listed the my first post.

    Code:
    [B]foreach ($_GET as $var => $value) {
    $user .= $var;
    $user .= '=' . $value;
    }
    $user = substr($user, 5);
    echo $user; [/B]
    It would be more convenient to have it all handled by htaccess.