folder to var

Discussion in 'Apache' started by jvoosten, Jan 31, 2011.

  1. #1
    hello,

    I'm going to buy a book on apache (the server!) after this one.

    I'm looking for a short script that converts one and two foldername(s) to vars in the address bar.
    for example:

    www.domain.com/visitors or www.domain.com/visitors/ to www.domain.com/?page=visitors

    and

    www.domain.com/visitors/rambo or www.domain.com/visitors/rambo/ to www.domain.com/?page=visitors&item=rambo

    and

    www.domain.com/store/dvd or www.domain.com/store/dvd/ to www.domain.com/?page=store&item=dvd

    hope someone can come up with a simple solution!
    thanks in advance!

    Jelle
     
    jvoosten, Jan 31, 2011 IP
  2. Natcoweb

    Natcoweb Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What language will be used for the script? May be mod_rewrite can do the job: RewriteRule ([A-Za-z]+)/([A-Za-z]+)/? ./index.php?page=$1&item=$2 [QSA]
     
    Natcoweb, Feb 1, 2011 IP
  3. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes you need to do this via .htaccess with mod_rewrite
     
    srisen2, Feb 4, 2011 IP