08.01 php
SPFHelper
Note
SPFHelper did not leave a note
  1. Hi all,
  2. I am bogged on some PHP coding and I am hoping someone here could help me please.
  3.  
  4.  
  5. What I am trying to do is this:
  6.  
  7. My URL ---> http://www.123domain.com/?ref=12345
  8.  
  9. Redirect File ---> http://www.123domain.com/456.php
  10.  
  11. Destination URL ---> http://www.456domain.com?id=12345&url=http%3A%2F%2Fwww.789domain.com%2F
  12.  
  13.  
  14. So, instead of linking directly to the "Destination URL", I want to first go to the "Redirect File" and then the "Destination URL". This way, I can easily modify a single file instead of updating multiple pages each time when I have to modify a destination.
  15.  
  16.  
  17. I also tried using .htaccess and it works for redirecting, but I can't seem to add the ?ref=12345 and convert it to id=12345.
  18.  
  19. Using .htaccess, I tried the following:
  20. /456.php "http://www.456domain.com?id=<?php echo $keywordget; ?>&url=http%3A%2F%2Fwww.789domain.com%2F"
  21.  
  22. If I could use .htaccess to do it all I would as then I only need 1 file for everything, and the redirect files are all aliases because the .htaccess would redirect them immediately.
  23.  
  24.  
  25. I have tried a few things as well and I am still stuck. For example, I have used the following code to extract the 12345 part:
  26.  
  27. <?php
  28. $ref = $_GET['ref'];
  29. $ref = urlencode($ref);
  30. ?>
  31.  
  32. Now, the above code works perfectly on the same page, meaning, if I put <?php echo $ref; ?> on the page, it will display "12345". What I am trying to do though is redirect and keep the 12345 in the redirected URL.
  33.  
  34.  
  35. Thanks,
  36.  
  37. SPFHelper
Parsed in 0.052 seconds, using GeSHi 1.0.7.14

Modify this Paste