Hiding ID in php extension

Discussion in 'PHP' started by Curion, Mar 30, 2008.

  1. #1
    I need some help with rewriting the php extension with htaccess. Let's say my php url is mydomain.com/content/id/filetitle.html and I want to get rid of the id in the URL, how do I do it? If without htaccess rewrite, normal extension will be mydomain.com/file.php?f=id

    Thanks.
     
    Curion, Mar 30, 2008 IP
  2. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #2
    I would do the link like:

    /file.php?12/Article_Cloning_for_fun_and_profit

    and in file.php

    Insert into first line:

    
    list($_GET['id'],$_GET['title']) = explode('/',$_SERVER['QUERY_STRING']);
    //$_SERVER['QUERY_STRING'] should contain 12/Article_Cloning_for_fun_and_profit
    
    PHP:
    No need for htaccess rewrite.

    Peace,
     
    Barti1987, Mar 30, 2008 IP