6 replies
I am at a bind of how to make
my PHP Redirection to an affiliate
product page work.

This is what I know and have done:

Created a folder called "recommend"

Opened and saved a notepad file in the
"recommend" folder which I named "index.php"

The only content in the "index.php" is

<?php
header("location:http://www. xxx . com");
exit;
?>


The XXX.com is replaced with my affiliate
link anyway.

I uploaded the "recommend" folder
with the index.php inside.

When I access it from the browser through XXX.com/recommend,
it does not take me to the affiliate page. In short it does not work.

Please what am I missing out? Is the above code even
complete, or is there more coding to make it work?
#php #redirection
  • Profile picture of the author PCRoger
    I put a space after the location:

    and I usually put

    exit();

    but other than that, looks ok to me.

    PCRoger
    Signature
    Track your affiliate sales back to the ARTICLE or WEBSITE that generated the sale. CBSaleTracker

    I was making money in days with the 4 Day Money Making Blueprint

    {{ DiscussionBoard.errors[1747715].message }}
  • Profile picture of the author butters
    Got a feeling it would be better off posted here. Programming Talk
    {{ DiscussionBoard.errors[1747721].message }}
  • Profile picture of the author rajivkumar900
    open notpad and paste this code
    <?php
    header("location:your affiliate link goes here like http://www.yahoo.com/youraffiliatelink");
    ?>
    save this file with ".php" extention.
    then upload it to your server.
    this will surely work..if face any problem feel free to contact me any time.
    Signature

    Rajiv Kumar
    Skpe: rajivkumar900
    Email id : rajivkumar900@gmail.com

    {{ DiscussionBoard.errors[1747739].message }}
  • Profile picture of the author Zeus66
    This is the correct code. Don't change anything at all except to replace the URL. Don't add or remove any spaces or make any other changes at all:

    HTML Code:
    <?php
    header( 'location: http://www.yourdomain.com' ) ;
    ?>
    {{ DiscussionBoard.errors[1747800].message }}
  • Profile picture of the author mywebwork
    Originally Posted by GoingSomewhere View Post


    Opened and saved a notepad file in the
    "recommend" folder which I named "index.php"

    The only content in the "index.php" is

    <?php
    header("location:http://www. xxx . com");
    exit;
    ?>
    Just a thought - as you used Notepad instead of a proper text editor are you sure that the file got saved as "index.php" and not as "index.php.txt"? If you don't change the file type when you save with Notepad it will automatically append a ".txt" to every document it creates.

    Also, the final "exit" statement is really not needed, but I don't think it's the issue.

    BTW, I also agree with butters - this thread really belongs in the "Programming Talk" forum and not in the main one!

    Bill
    {{ DiscussionBoard.errors[1748307].message }}

Trending Topics