what is the difference between these lines of code?

Discussion in 'PHP' started by digital1016, Feb 1, 2008.

  1. #1
    
    RewriteRule    ^([\d]{2}).html$	index.php?n=$1
    RewriteRule		^(.+)\.html$ index.php?n=$1 [QSA,L]
    
    PHP:
    what is the difference between these 2 lines of code. thanks
     
    digital1016, Feb 1, 2008 IP
  2. nelse

    nelse Peon

    Messages:
    87
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    These are from .htaccess file? I think that first line catches strings containing only digits (\d) of 2 characters length ( {2} ). For example: 00.html, 53.html, 99.html. The second line catches all strings.
     
    nelse, Feb 1, 2008 IP
  3. digital1016

    digital1016 Active Member

    Messages:
    153
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    sorry yes they are, i think i may have posted in the wrong forum now that i think of it.

    im wondering is there a string i could use for letters and numbers.


    i have links on my page that just contain 2 numbers.html and then there are links that contain letters and maybe a number at the end.

    seems as if i cannot use these 2 strings together in my htaccess file , do you know what string i can use ?

    thank you
     
    digital1016, Feb 1, 2008 IP
  4. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #4
    do something like this

    ^([0-9]{2}|[a-z][a-z0-9])\.html$
     
    Kaizoku, Feb 1, 2008 IP
  5. Sabbir

    Sabbir Banned

    Messages:
    210
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #5
    I think it means you need all pages. why to devide it within 2 categories?
     
    Sabbir, Feb 1, 2008 IP
  6. zerostar07

    zerostar07 Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    the second line *does* catch all letters and numbers:)
     
    zerostar07, Feb 2, 2008 IP