Domain Manage

php Redirect

Discussion in 'Website Design' started by lee, Mar 5, 2014.

Thread Status:
Not open for further replies.
  1. lee United Kingdom

    lee Active Member

    Joined:
    Feb 2013
    Posts:
    277
    Likes Received:
    3
    I want to mask an affiliate link and send people off to a php page before a redirection. I have had this working before but now I am getting 500 Internet Server Error, can someone please tell me what I am doing wrong (I am trying to sleep off a night shift, so is probably me being stupid.)

    I have the following code;

    < ?php header("Location: http://www.bbc.co.uk/"); >

    In a test.php page in the root direction of the domain.

    Thanks in advance!
     
  2. Domain Forum

    Acorn Domains Elite Member

    Joined:
    1999
    Messages:
    Many
    Likes Received:
    Lots
     
  3. RobM

    RobM Well-Known Member Exclusive Member

    Joined:
    Mar 2012
    Posts:
    1,089
    Likes Received:
    36
    No question mark for the close tag?

    ?>

    Also make sure the file has permissions for the user/net
    eg chown user:user test.php

    Some servers are set not to run php files with root permissions
     
  4. lee United Kingdom

    lee Active Member

    Joined:
    Feb 2013
    Posts:
    277
    Likes Received:
    3
    Thanks Rob.

    Added ? and set file permissions to 777 on a temp basis, with no change, I still receive the error message.

    I have googled the code required and all sites seem to suggest its correct. I just cannot work out why it will no longer work.
     
  5. PoshTiger United Kingdom

    PoshTiger Well-Known Member

    Joined:
    Jun 2011
    Posts:
    1,241
    Likes Received:
    25
    is it the space at the start between < and ?

    should be <?php
     
  6. RobM

    RobM Well-Known Member Exclusive Member

    Joined:
    Mar 2012
    Posts:
    1,089
    Likes Received:
    36
    No I didn't mean change the read/write permissions I actually meant change the ownership of the file.
    chown user:user test.php
    where [user] is the username of the account
    An internal server error occurs on some servers where a file is set to
    root:root test.php

    <?php header("location: http://www.bbc.co.uk/"); ?>
     
  7. lee United Kingdom

    lee Active Member

    Joined:
    Feb 2013
    Posts:
    277
    Likes Received:
    3
    Thanks for the input.

    Removed space, no change. Moved out of root info a subfolder - no change.

    I'm out of ideas!
     
  8. lee United Kingdom

    lee Active Member

    Joined:
    Feb 2013
    Posts:
    277
    Likes Received:
    3
    Ah, sorry Rob, I misunderstood. I don't think I have command line access through this Cpanel account. Of if I do, I don't recall every seeing where I would access it.

    I also don't remember having to change teh ownership when I plopped them up there last time. I don't recall doing anything different to what I have done today to be honest.
     
  9. RobM

    RobM Well-Known Member Exclusive Member

    Joined:
    Mar 2012
    Posts:
    1,089
    Likes Received:
    36
    As an aside you can check that it's not the actual command by trying:

    <?php echo 'test'; die(); ?>
    in it's place

    If that fails to run it's the file not the command
    If you want to setup temporary access just PM me with details and I'll login and have a look for you. No probs if you don't.
     
  10. lee United Kingdom

    lee Active Member

    Joined:
    Feb 2013
    Posts:
    277
    Likes Received:
    3
    That didn't run, so I guess its the file itself. I have opened support ticket with the hosting company as its not my site (otherwise I would have given you access)

    Thanks for your time :)
     
  11. RobM

    RobM Well-Known Member Exclusive Member

    Joined:
    Mar 2012
    Posts:
    1,089
    Likes Received:
    36
  12. greg2013 United Kingdom

    greg2013 Member

    Joined:
    Dec 2013
    Posts:
    32
    Likes Received:
    1
    Do you have a .htaccess file? 500 is usually a .htaccess issue.
    Made any recent changes to it?

    If you remove the entire redirect code does the issue go away?
     
  13. lee United Kingdom

    lee Active Member

    Joined:
    Feb 2013
    Posts:
    277
    Likes Received:
    3
    Its been an interesting afternoon. After I misread Robs suggestion, I changed the permissions on the php file to 777 whilst I gave it a quick check. It didnt work, so I changed it back.

    Then I realised that ALL the WP sites under that Cpanel account were getting the 500 error. The straightforward html sites were ok, so there appears to be a permissions problem across the whole account.

    Krystal are investigating for me :) - I have to say this is not the first time I have had to call on them for assistance and they are shit hot.
     
Thread Status:
Not open for further replies.

Share This Page