Need help redirecting Users

Discussion in 'PHP' started by JinRoh, Aug 2, 2007.

  1. #1
    Hello, I am trying to do some things with mod_rewrite, but I'm not very good at it.

    Now I have a Rule
    RewriteRule ^css/video/([0-9]+)/$ /?video=$1
    Code (markup):
    So /css/video/17/ actually uses /?video=17

    But, the problem is that I want visitors using old links to be redirected to the new URL (So , do the inverse thing, if an user enters /?video=17 to be redirected to /css/video/17/ ,that actually will use /?video=17 :D)

    Do you think is it possible to do that with Mod Rewrite? Or with PHP maybe?
     
    JinRoh, Aug 2, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    nico_swd, Aug 2, 2007 IP
  3. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #3
    krt, Aug 2, 2007 IP
  4. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #4
    Err never mind. I just tried what i posted. infinite loop. blah
     
    exodus, Aug 2, 2007 IP
  5. JinRoh

    JinRoh Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hello, well I found a solution (Thanks to "ekneuss" at #apache@quakenet.org), but I am still seeking for a "cleaner" alternative.

    It would consist in placing a $new var, and using /?video=XX&new in the New, rewrited urls, and in case an user visites /?video=XX withour $new, it would be redirected to the new, rewrited URL.

    What do you think of that? Will I have any problem with that? Is there any other possibility? (using rewrite, or apache)

    PS: "krt" solution didn't work :(

    -----------

    EDIT: Well, the &new solution seems to work. Check , for example www.chetos.es/?video=39 or www.chetos.es/?game=dod&top=15&video=10 (old urls) and see how you are redirected to the new, static urls :)

    -----------
     
    JinRoh, Aug 3, 2007 IP
  6. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #6
    I fixed the issue with my one, I used QUERY_STRING instead of REQUEST_URI during a mind block or something :p
     
    krt, Aug 4, 2007 IP