Making links in php

Discussion in 'PHP' started by buda, Jul 30, 2007.

  1. #1
    I need a litle help.

    When making links as "index.php?page=page1" what code I have to add to the head section (or somwhere else) of page, so when I click on it I go to "./content1/page1.php", for examle...

    I saw somwhere code for this, but I forgot where, and I also used google, but I found nothing...

    P.S. Sorry if similar thread exist, I didn't found it..
     
    buda, Jul 30, 2007 IP
  2. themole

    themole Peon

    Messages:
    82
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This is probably what you're looking for:

    
    RewriteEngine on 
    RewriteRule ^content1/(page[0-9]+)\.php$ page_handler.php?page=$1 [L]
    
    Code (markup):
    Just put that in your .htaccess file

    Here's an alternate way I've listed in another thread:
    http://forums.digitalpoint.com/showthread.php?t=84802#4

    -the mole
     
    themole, Jul 30, 2007 IP
  3. buda

    buda Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanx the mole, but that is not what I have been searching for... I already found this solution on the web, but I was searching for the other way that I saw somwhere few days ago - to put a piece of code in the page, a parser that simply translates links - for example:
    if page = page1 than goto domain.com/page1.php (this is for illustration of intention)...

    Thanx anyway for your response...
     
    buda, Jul 31, 2007 IP
  4. nagasharmi

    nagasharmi Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That concept is httpaccess.
    this concept is used to hidden original file to user.
    administrator only know the original file name.
     
    nagasharmi, Aug 2, 2007 IP
  5. buda

    buda Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I come up with something that works:
    $page = $_GET['page'];
    if($page == page1)
        header('Location: http://domain.com/page1.php');
    
    Code (markup):
    :cool:
     
    buda, Aug 2, 2007 IP