Help with .htaccess rewrite

Discussion in 'PHP' started by jeffczyz, Feb 4, 2009.

  1. #1
    jeffczyz, Feb 4, 2009 IP
  2. Femto

    Femto Peon

    Messages:
    23
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteRule ^(.*)$ index.php?var=$1[L]

    or some thing like that
     
    Femto, Feb 4, 2009 IP
  3. jeffczyz

    jeffczyz Peon

    Messages:
    62
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks.. I have that a try and it didn't work.

    instead of taking the string after the / in that folder and using it a variable, it used index.php[L]

    so my url was domain.com/process/abcd and it rewrote it as var=index.php[L]
     
    jeffczyz, Feb 4, 2009 IP
  4. zealus

    zealus Active Member

    Messages:
    70
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #4
    [L] at the end means stop processing any more rules. Not sure if it's a good idea, since there could be more rules below that.

    Also, from a SEO point of view it always makes sense to add R=301 so that Google would understand that it's a same page and increase its ranking/not punish for duplicate content. Anyway, just a sensible thing to do.
     
    zealus, Feb 4, 2009 IP
  5. Femto

    Femto Peon

    Messages:
    23
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    so what about

    RewriteRule ^process/(.*)$ index.php?var=$1[L]


    @zealus you are right , but i used it to make sure that it the only current rule for testing purpose
     
    Femto, Feb 4, 2009 IP
  6. jeffczyz

    jeffczyz Peon

    Messages:
    62
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    cool.. I got it now.. thanks
     
    jeffczyz, Feb 4, 2009 IP