Asking to change my URL

Discussion in 'PHP' started by marki8, Mar 29, 2008.

  1. #1
    Hei dp members,

    i want to know... how to change this url :-

    /articledetail.php?id=12&title=Article%20Cloning%20for%20fun%20and%20profit

    to

    /articledetail.php/id/12/title/Article_Cloning_for_fun_and_profit
     
    marki8, Mar 29, 2008 IP
  2. Im The ONE

    Im The ONE Peon

    Messages:
    800
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you need to convert whitespaces to underscores.
    <?php
    $title = str_replace(" ","_","$title);
    ?>

    Mod Rewrite code:
     
    Im The ONE, Mar 29, 2008 IP
  3. marki8

    marki8 Well-Known Member

    Messages:
    977
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    135
    #3
    get some error

    Parse error: syntax error, unexpected T_STRING in
     
    marki8, Mar 29, 2008 IP
  4. c4st

    c4st Peon

    Messages:
    41
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4


    That error is nothing related to the code Im The One gave you. Make sure you placed the code in the right place or you didn't copy and paste it wrong.
     
    c4st, Mar 29, 2008 IP
  5. Barti1987

    Barti1987 Well-Known Member

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

    /articledetail.php?12/Article_Cloning_for_fun_and_profit

    and in articledetail.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 29, 2008 IP
  6. marki8

    marki8 Well-Known Member

    Messages:
    977
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    135
    #6
    
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/ajak/public_html/eacharticle.com/articledetail.php:2) in /home/ajak/public_html/eacharticle.com/articledetail.php on line 3
    Code (markup):
    not work..
    i think it use 2 page. One index.php and articledetail.php

    at index.php i change it to this code
    <a href="articledetail.php?id=<?=$line[articleid]?>&title=<?=$line[articletitle]?>">
    Code (markup):
    result :
    /articledetail.php?id=12&title=Article%20Cloning%20for%20fun%20and%20profit


    so what you think? i need help...
     
    marki8, Mar 31, 2008 IP
  7. singh.ajit05

    singh.ajit05 Peon

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    $line[articletitle]?>">
    $articletitle = str_replace(" ","_",$line[articletitle]);
    <a href="articledetail.php?id=<?=$articleid?>&title=<?=$articletitle?>">
     
    singh.ajit05, Apr 1, 2008 IP
  8. marki8

    marki8 Well-Known Member

    Messages:
    977
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    135
    #8
    thanks singh but it still not work...

    how much cost if i want to hire someone for this job?
     
    marki8, Apr 1, 2008 IP
  9. singh.ajit05

    singh.ajit05 Peon

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    can contact with me for PM or my personal id - gmail.com
     
    singh.ajit05, Apr 2, 2008 IP