1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Php dynamic page to static

Discussion in 'PHP' started by mitchbuch, Oct 30, 2009.

  1. #1
    I wondered if anyone could help me this.

    I have a php file that displays some news articles from a db.

    When it displays a news article it is e.g. index.php?news=186

    But I would prefer to instead have it look like static, in other words. Folder based URL Scheme.

    So instead of index.php?news=186

    I would like it to look like this

    www.domain.com/news/186/news headline

    How can I get that?
     
    mitchbuch, Oct 30, 2009 IP
  2. aras

    aras Active Member

    Messages:
    533
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #2
    You need to look into .htaccess URL rewriting.
     
    aras, Oct 30, 2009 IP
  3. techbabu

    techbabu Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You should read about Apache mod_rewrite. It'll help you a lot.


    TechBabu
    Don't just make a website: Make an impact
     
    techbabu, Oct 30, 2009 IP
  4. mitchbuch

    mitchbuch Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #4
    ok, so is this difficult, or is it something a noob can do easily with a tutorial?
     
    mitchbuch, Oct 30, 2009 IP
  5. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #5
    Sky AK47, Oct 30, 2009 IP
  6. techbabu

    techbabu Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hey

    You need something like in your httpd.conf

        RewriteEngine on
        RewriteLog logs/rewrite_log
        RewriteLogLevel 3
        RewriteRule /?news=186   /news/186/news [R]
    Code (markup):

    TechBabu
    Don't just make a website: Make an impact
     
    techbabu, Oct 30, 2009 IP