help a newb out! - I cant do a simple php redirect on Blueshost!! :(

6 replies
Hi guys...

So here is the deal... on the root of my domain I created a folder using the FTP program (Filezilla).

Created 4 nice little php files to redirect my affiliate links, for cloaking purposes.

I then create write my copy with the link pointing to them... browser returns error 500. I've opened a ticket with them, but they're taking forever!

Here is the code I'm using on the php files. Done on notepad++ ensuring php and UTF-8

<?php
header(“Location: xttp://XXXXXXX.XXX.XXX.XXX/”);
?>
Any ideas on what the heck is wrong, please?

ps: scrambling up the actual link because my post count is lower than 15
#blueshost #newb #php #redirect #simple
  • Profile picture of the author unnatural
    Not sure if this will fix your issue or not, but it looks like those are smart quotes.

    Try copying and pasting this (smart quotes have been removed).

    <?php
    header("Location: xttp://XXXXXXX.XXX.XXX.XXX/");
    ?>

    If you compare this to your own code you should notice the slight difference in the quotes.
    {{ DiscussionBoard.errors[4900504].message }}
    • Profile picture of the author gurruwiwi
      Originally Posted by unnatural View Post

      Not sure if this will fix your issue or not, but it looks like those are smart quotes.

      Try copying and pasting this (smart quotes have been removed).

      <?php
      header("Location: xttp://XXXXXXX.XXX.XXX.XXX/");
      ?>

      If you compare this to your own code you should notice the slight difference in the quotes.
      That was exactly the issue !!!

      Thank you so very much !!

      :p
      {{ DiscussionBoard.errors[4901349].message }}
    • Profile picture of the author Codez
      Originally Posted by unnatural View Post

      Not sure if this will fix your issue or not, but it looks like those are smart quotes.

      Try copying and pasting this (smart quotes have been removed).

      <?php
      header("Location: xttp://XXXXXXX.XXX.XXX.XXX/");
      ?>

      If you compare this to your own code you should notice the slight difference in the quotes.
      this only works if headers have not been sent yet. if headers have been sent then i normally use a meta redirect
      {{ DiscussionBoard.errors[4904070].message }}
  • Profile picture of the author jmartinez
    Keep this in mind straight from the php documentation:

    Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.
    If you have that in order try setting up a redirect to anything, like to google.com or something. Load that into your browser and see if it works. If it does then you know the header function is working properly and that most likely isn't your issue. It could be the quotes like posted above, the xttp protocol or something else.
    {{ DiscussionBoard.errors[4901066].message }}
  • Profile picture of the author Jason Z
    Those quotes will get you every time. Good catch unnatural.
    Signature
    Co-Founder of the Local Profit Model Training Program for Offline Consultants

    Jason Zimmerman is an offline marketing and consulting professional. He has been developing web sites and digital marketing plans for local businesses since 2000.
    {{ DiscussionBoard.errors[4901946].message }}
  • Profile picture of the author eminc
    Hi,

    Try a meta redirect instead.

    <meta http-equiv="refresh" content="0;url=NEW PAGE URL" />


    Mohit
    {{ DiscussionBoard.errors[4904079].message }}

Trending Topics