Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

php Redirect

Status
Not open for further replies.

lee

Joined
Feb 11, 2013
Posts
290
Reaction score
7
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!
 
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
 
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.
 
is it the space at the start between < and ?

should be <?php
 
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/"); ?>
 
Thanks for the input.

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

I'm out of ideas!
 
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/"); ?>

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.
 
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.
 
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 :)
 
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?
 
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.
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom