Need a new web host or having a problem with a script? Tips and advice on the best way to design, build and maintain your most valuable asset - your website!

Redirect PHP parse error

Alexis
 
Posts: 13
Joined: 28 Apr 09

Redirect PHP parse error

Hi,
I'm following the tutorial for making redirects for wordpress.
here's my code:
<?php
header( ‘Location: http://www.hypnosisdownloads.com/?0000’ ) ;
?>

I've done everything exactly as per instructions but I'm getting the error message as follows:
" Parse error: syntax error, unexpected ':' in /public_html/blog-ehyp/recommends/hypnosisdownloads/index.php on line 2 "

Well, I can't see an extra ":" anywhere !
Any ideas please?
Thanks
 

faradina
 
Posts: 2171
Joined: 01 Jun 09
Location: Philippines

Did you use Word at any phase in the process of creating your redirect file? Word is the most common culprit for parse errors. Use notepad to make your index.php redirect file.
 

Alexis
 
Posts: 13
Joined: 28 Apr 09

Hi Faradina,

No, just notepad, clean and simple.
I don't know what else to try, at the moment I'm stuck with ugly links on my wordpress sites.
Any ideas gratefully received ! ;-)
Thanks
 

faradina
 
Posts: 2171
Joined: 01 Jun 09
Location: Philippines

Are you on Hostgator? Another member had this same problem. He's on hostgator and hostgator support went into it and cleaned out the error. Check this forum topic:

week-5-8-f37/redirect-index-php-not-working-please-help-t3744.html
 

Alexis
 
Posts: 13
Joined: 28 Apr 09

I checked with my host, Bluehost and the problem is that the link I was using uses the single exclamation mark as here: '
When I use the double one, as here: "
the link works perfectly.
Hope this helps somebody. ;-)
 

JasonDodd
 
Posts: 874
Joined: 08 Feb 09
Location: New Zealand

It appears something similar was happening on this wordpress site with a parse error.

The code Mark posted used the double quotes but also has an exit line. The exit stops any further code being executed on the page and can sometimes be an effective security measure against any malicious code being run on the page.
 

Limited time special - Try Affilorama Premium for just $1 for 7 days: http://www.affilorama.com/premium
 
abrandan
 
Posts: 11
Joined: 23 Nov 09
Location: Canada

I seemed to have the same error when I used Notedpad. But using TextEditor on a Mac seems to work fine with the redirect for Clickbank products.
However, when I use an affiliate code for another outfit, even though I use the exact same php code with the new affiliate code I get the same error mentioned above. Maybe I'm wrong but I think some affiliate programs are blocking the redirect - am I wrong? (and I'm using the exit code that Mark used). The affiliate program I'm taking about is ShareASale.
 

Angela B
 
Moderator
EvoBilly
 
Posts: 769
Joined: 27 Oct 08
Location: New Zealand

ive seen this issue around and i think it is coursed in some cases by the comma ' there are some that have a little curl on them well other look like a little straght dash and it seems it donsn't like the curl as it must see it different.

try copy and paste this code see if it works
Code: Select all
<?php
header( 'Location: http://www.hypnosisdownloads.com/?0000' ) ;
?>
 

For the best guide to sell physcal products as a affiliate check out Matt Carters Rapid Profit Formula http://online-income-masters.com/getrapidprofitformula.php

If your having trouble re-writing your articles i recommend checking out this tool to make it quick and easy http://bit.ly/b9z5t0

If you want to outsource your articles this place seems to be good value and easy to deal with, and its free to sign up they offer a 100% American writing team http://bit.ly/bhv4Fu
 
Site Admin
Nick
 
Posts: 297
Joined: 17 May 06
Location: New Zealand

Indeed. It also pays to put an exit after it as well

<?php
header('Location: ......');
exit;
?>