redirect links via php

Discussion in 'PHP' started by fadetoblack22, Sep 26, 2008.

  1. #1
    fadetoblack22, Sep 26, 2008 IP
  2. agentsmith77

    agentsmith77 Active Member

    Messages:
    176
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    66
    #2
    agentsmith77, Sep 26, 2008 IP
  3. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #3
    fadetoblack22, Sep 27, 2008 IP
  4. agentsmith77

    agentsmith77 Active Member

    Messages:
    176
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    66
    #4
    okay I think I'm starting to understand, so you just want to link from a PHP page to Any website?

    
    <?php
    header("Location: http://forums.digitalpoint.com");
    ?>
    
    PHP:
    Put that in any PHP page and it'll redirect to DP...

    Was this what you wanted?
     
    agentsmith77, Sep 27, 2008 IP
  5. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #5
    I'm not sure if that is what I need.

    Basically I want my long href links to link with nice urls and not to pass PR.
     
    fadetoblack22, Sep 27, 2008 IP
  6. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The way that quangvan described doesnt help you if you want to have a PR on that page as it redirects immediately. If you want to do that you will need to have a javascript redirect really, and a link on that page if the users javascript is disabled

    take a look at
    http://www.tizag.com/javascriptT/javascriptredirect.php
     
    JAY6390, Sep 27, 2008 IP
  7. agentsmith77

    agentsmith77 Active Member

    Messages:
    176
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    66
    #7
    honestly I have no idea what you want fadetoblack22

    the length of your url has nothing to do with pagerank.

    So you want to just make the url's shorter? sounds like you need mod_rewrite .htaccess, like wordpress url's correct?
     
    agentsmith77, Sep 27, 2008 IP
  8. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #8
    The example of what I want is in the http://www.pokerlistings.com top 10 list.

    I will look into the .htaccess to see if it is what I need.
     
    fadetoblack22, Sep 28, 2008 IP
  9. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #9
    well since that just redirects directly, you can use just .htaccess. This is how it is done

    .htaccess
    # Set up the rewrite engine
    RewriteEngine On
    RewriteBase /
    
    # create rule for googlebooks
    RewriteRule ^googlebooks\.php$ http://books.google.com/googlebooks/about.html [R=301,L]
    Code (markup):
    Jay
     
    JAY6390, Sep 28, 2008 IP
  10. conductr

    conductr Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I personally like to use a combination of the two:

    In .htaccess,
    RewriteRule ^pages/([a-z]+)$ redirect.php?slug=$1 [NC,QSA]

    In redirect.php,
    <?
    if($slug == 'googlebooks'){
    header 'Location: http:google/stuff';
    }
    ?>


    Doing it this way, you can easily save all your links in the database. Or, if you only have a few the if/else will work. Also, you can do click tracking and other nifty things.


    yoursite/pages/googlebooks will redirect you
     
    conductr, Sep 28, 2008 IP
  11. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #11
    This is another example:

    http://www.pokerteam.com

    The "Online Poker Room Comparison Chart" type of links is what I am looking for.
     
    fadetoblack22, Oct 2, 2008 IP