Stuck with small HTACCESS issue

Discussion in 'PHP' started by imchandan, Jul 21, 2008.

  1. #1
    Hi guys,
    i m writing something like this
    RewriteCond ^Check(.*).html /publish/change.php?id=123&orderby=$1 [R]

    ..
    Now the problem is after i type mysite.com/Check01.html , it changes it to mysite.com/publish/change.php?id=123)"derby=01.
    So basically it is treating &order as something else and changing it to Ascii Value )". please help.
    Thanks,
    Chandan
     
    imchandan, Jul 21, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    RewriteRule ^Check(\d+)\.html$ /publish/change.php?id=123&orderby=$1
    
    Code (markup):
    ... give this a try.

    Did you upload the file as Binary or ASCII?
     
    nico_swd, Jul 21, 2008 IP
  3. Cri2T

    Cri2T Peon

    Messages:
    104
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Don't you have to backslash the amp sign?
     
    Cri2T, Jul 21, 2008 IP
  4. imchandan

    imchandan Guest

    Messages:
    50
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #4
    didn't work either...
    my problem is anywhere if it is &or then it will convert it into )".......
    if i use &oderby (removed r) then i works fine...
    hope i am able to explain it properly....
    so is it like, we can;t use &or together...????
    i know this can be done alternately also like moving orderby to previous, then &or will not be together
    like /publish/change.php?orderby=$1&id=123 [L], but this is not a solution...
    please help
     
    imchandan, Jul 21, 2008 IP
  5. DanPonjican

    DanPonjican Active Member

    Messages:
    268
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    80
    #5
    DanPonjican, Jul 21, 2008 IP
  6. ahowell

    ahowell Peon

    Messages:
    38
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The following code is tested and works:

    assuming you don't want people knowing where the code is being run, you shouldn't finish the rule with [R].

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule check(.*)\.html publish/change.php/?id=123&orderby=$1
    </IfModule>
    Code (markup):
     
    ahowell, Jul 21, 2008 IP