Redirect help really needed...

Discussion in 'Apache' started by Jona, Jul 7, 2007.

  1. #1
    I need both the urls below

    http://www.mydomain.com/index.php?k=keyword&s=seller
    http://www.mydomain.com/?k=keyword&s=seller

    to become like one of the three below, the one that will work
    best for both engines and humans ... Any sugestions ???

    http://www.mydomain.com/keyword/seller.html
    http://www.mydomain.com/keyword/seller/
    http://www.mydomain.com/keyword/seller

    Lest say we can get it too look like this:

    http://www.mydomain.com/keyword/seller.html

    Later, whenit works, HOW can I get bacl the value for the variables
    in my PHP script? I.e ... How do I get $k to be "keywords" and $s to
    be "seller" so I can use the posted values in my php prg's ???
     
    Jona, Jul 7, 2007 IP
  2. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #2
    Options FollowSymLinks
    RewriteEngine on
    RewriteRule ^([^/]+)/([^/]+)/$ index.php?k=$1&s=$2 [L,NC]
    RewriteRule ^([^/]+)/([^/]+)\.html$ index.php?k=$1&s=$2 [L,NC]

    You can use $_GET or $_REQUEST to get back the values of the variables. Something like $k = $_REQUEST['k']; and $s = $_REQUEST['s'];
     
    VimF, Jul 8, 2007 IP