#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2008
    Posts
    8
    Rep Power
    0

    Jump script problem


    Hi, I'm trying to set up a jump script for my affiliate links. But, I seem to have a problem.

    Here is what I've done. Affiliate links are replaced by links to folder/affiliate_specific_name

    folder is being redirected to my jump script.


    RewriteEngine On
    RewriteRule ^folder/([/_0-9a-zA-Z-]+)$ includes/jump.php?id=$1

    here is the jump script
    PHP Code:
    <?php
    $urls 
    = array(
      
    'name' => 'http://www.domain.com/',
      
    'name1' => 'http://www.domain1.com/'
    );
    $default_link 'http://www.mydomain.com';
    foreach(
    $urls as $name => $url){
      if(
    $name == $_GET['name']){ // some string matching functions could be used, too for matching in any CaSE
        
    header("Location: $url");
        die();
      }
    }
    // name not found go to default url
    header("Location: $default_link");
    ?>
    When I click the link I get directed to the standard 404 page not the default link.

    Can anyone help?

    thanks
  2. #2
  3. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,136
    Rep Power
    1990
    From what I've seen from my experience with .htaccess files, the reason that you get the 404 page instead of what you are expecting is that you have an error somewhere in the rewrite rule regex. It can be very painful to track down as well, as there's pretty much no debugging help for this.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2008
    Posts
    8
    Rep Power
    0

    Debugging


    Some painful trial and error did the job with the rewrite rule. Not surprisingly it was something stupid.

    In the end I ended up using a different jump script. If anyone is interested you can find it here, http://www.seobook.com/archives/001935.shtml.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2010
    Posts
    10
    Rep Power
    0
    I see there is an error between ur get's
    RewriteEngine On
    RewriteRule ^folder/([/_0-9a-zA-Z-]+)$ includes/jump.php?id=$1
    ^^ is asking for $_GET['id']
    if($name == $_GET['name']){ is asking for $_GET['name']
    i don't see any mention about id in there

IMN logo majestic logo threadwatch logo seochat tools logo