how can i use htaccess to rewrite these urls plz

Discussion in 'Apache' started by paul174, Sep 12, 2010.

  1. #1
    hello i need help to rewrite these urls
    my urls looks like this
    /index.php?module=video&id=1228&comm_page=2
    Code (markup):
    i want it like this example
    /video/1228/somethingelse/comm_page/2
    Code (markup):
    any help plz
     
    paul174, Sep 12, 2010 IP
  2. st1905

    st1905 Well-Known Member

    Messages:
    573
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    135
    #2
    RewriteRule ^index\.php?module=video&id=1228&comm_page=2$ video/1228/somethingelse/comm_page/2 [L]
    Code (markup):
    Should work.
     
    st1905, Sep 12, 2010 IP
  3. GingerTheCat

    GingerTheCat Active Member

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #3
    I thought you had to use a RewriteCond %{QUERY_STRING} line as well as ReWrite rule if you had parameters?

    It's explained here http://designertuts.com/htaccess-stopping-page-not-found-errors/


    Mike
     
    GingerTheCat, Sep 12, 2010 IP
  4. paul174

    paul174 Greenhorn

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #4
    thank you but it didn't work . here is my htaccess now
    my old url is like
    index.php?module=video&id=$1
    Code (markup):
    and being rewrited as
    /video/137/video_title
    Code (markup):
    so i added a comment system which added a new string like
    index.php?module=video&id=$1&comm_page=
    Code (markup):
    so here is my htaccess
    RewriteRule ^video/([0-9]+)/([^/]*)/?$ index.php?module=video&id=$1 [L]
    Code (markup):
     
    paul174, Sep 12, 2010 IP