plz help me .htaccess

Discussion in 'PHP' started by yayyo, Aug 19, 2008.

  1. #1
    hi friends
    plz help me i have the problem in my friendly link

    i want to make my link to http://www.ya20.com/(name of game).html

    now its give me http://www.ya20.com/84-CarbonAutoTheft.html

    me i want it without id

    my file .htaccess is

    AddType application/x-httpd-php .xml
    RewriteEngine on
    RewriteRule ^([_A-Za-z0-9-]+).html play.php?id=$1 [L]
    RewriteRule ^([_A-Za-z0-9-]+).html cat.php?genre=$1 [L]

    thnaks in advance
     
    yayyo, Aug 19, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    They ID is used to fetch the game out of the database, if you like to use only the name, you need to rescript it so it can handle textual searches!
     
    EricBruggema, Aug 19, 2008 IP
  3. webboy

    webboy Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    if i am correct you will see
    http://www.ya20.com/play.php?id=84-CarbonAutoTheft

    you could do this

    RewriteEngine On
    #RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ /play.php?id=$1 [L]

    in your play php file you could do this

    if (isset($id)) {
    $string = explode('/',$id);
    // breakup the url so
    // stiring [0] = www.ya20.com
    // stiring [1]= 84-CarbonAutoTheft

    }

    in the same file use $string [1]; for the game search so every time you do a search eg http://www.ya20.com/(name of game) it will pass the value 2nd value on the url

    i would also trim the .html file off as that would make the search fail
     
    webboy, Aug 20, 2008 IP