The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mod_Rewrite and SuPHP

Discussion in 'General Discussion' started by Will Webb, Apr 30, 2016.

  1. Will Webb

    Will Webb Registered

    Joined:
    Apr 30, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Bristol, UK
    cPanel Access Level:
    Root Administrator
    I am trouble shooting a problem with my site. My affiliate links are processed through a mod_rewrite. The rule runs a php script which then forwards the visitor to the desired URL. After migrating to a shared VPS with Godaddy it no longer works. The link URL just shows in the browser address bar and the forwarding script does not work.

    Here are the details of my set up.
    CentOS & cPanel
    php 5.5
    suPHP is the handler being used
    AllowOverride ALL is enabled (by default I believe)
    RewriteEngine On (in .htaccess)

    This is the rule in my .htaccess

    Code:
    RewriteEngine On
    RewriteRule ^take_me_to/([/_0-9a-zA-Z-]+)?$ includes/go.php?id=$1
    This is what's in my go.php file

    Code:
    <?php
    if ($id == "ID taken from the link URL") {$url =affiliate URL}   
    
    header("Location: $url");
        exit();
    ?>
    I figure it must be something with how the rewrite is being done, or how the script is being run, or how the header is being handled.

    Can anyone help with this. Hopefully I've given enough detail.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    As far as the server environment, are you using a different version of Apache, or a different PHP handler, compared to the previous server?

    Thank you.
     
Loading...

Share This Page