Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

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.
 
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.

Rule #1: Be Respectful

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

Premium Members

New Threads

Domain Forum Friends

Lastest Listings

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Siusaidh AcornBot:
    Siusaidh has left the room.
      Siusaidh AcornBot: Siusaidh has left the room.
      Top Bottom