Need Serious Help With Redirect Code

by 7 replies
8
I want to have people who read my articles at the directories, be redirected to my affiliate offers, instead of going to my blogs. I found two redirect codes, and spent the whole night trying to get them to work, with no success.

I was told to put the code in the index.php file, and I assume that would be the one in the public_html folder, because there is also one in the wp-content folder.

I tried it in both with no success. If I put the code in the index.php file in the public_html folder, my site disappears, and I get syntax errors.

If I put it in the index.php file in the wp-content folder, nothing happens. I am not sure what is wrong, but I am out of options.

I have tried putting the code above and below the existing code that is already in those files.

Here are the two codes I have

Thanks Glenn

<?
Header ( "HTTP/1.1 301 Moved Permanently" );
Header ( "Location: http://clickbankid.merchant.hop.clickbank.net" );
?>



<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://clickbankid.merchant.hop.clickbank.net");
exit();

?>
#programming #code #redirect #serious
  • You can't just through codes anywhere.
    We need to know your setup so that you get told to put them in the correct place.

    We also need to know your goal.
    What place do you want to redirect to where?
    Your using WordPress, if you put a redirect code in, it will redirect the entire WordPress install.
    So if it is a specific page in WP, then you will need a template with the redirect to assign to that page.

    Don't use <?
    It should always be <?php
    • [1] reply
    • Looks like your using cPanel. You can just add a 301 redirect to your .htaccess in your public_html folder like this:

      redirect 301 /index.html http://clickbankid.merchant.hop.clickbank.net

      But it also looks like there is a problem with that link as well.
  • Try:

    Code:
    <?php
    Header (  "Location:  http://clickbankid.merchant.hop.clickbank.net"  );
    ?>
    ...and put it at the very start of your PHP file with nothing else before it.
  • You could just try the Redirection plugin for Wordpress.
  • Follow these steps:
    1)Install Quick Redirect plugin (free).
    2)Create a Page in wordpress, redirect page to desired url (just below the editing section of page).
    2)under settings->Reading - Set Front page as the newly created page.
    So now your site will be redirected correctly with out any problem.


    regards
    anuradhan
  • +1 for Redirection plugin for wordpress. It will also track visit count.
  • This is very interesting, couples also want to try it
  • Banned
    [DELETED]

Next Topics on Trending Feed

  • 8

    I want to have people who read my articles at the directories, be redirected to my affiliate offers, instead of going to my blogs. I found two redirect codes, and spent the whole night trying to get them to work, with no success. I was told to put the code in the index.php file, and I assume that would be the one in the public_html folder, because there is also one in the wp-content folder.