1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Question

Discussion in 'PHP & Perl' started by rdtdtd, Apr 1, 2009.

  1. rdtdtd

    rdtdtd Newbie

    Joined:
    Mar 24, 2009
    Messages:
    3
    Likes Received:
    0
    Total newb question, but nonetheless here it is. I'm attempting to set up a php redirect to my main site for a URL that my craigslist image ad will link to. I have several different ways to code it already researched, including a simple straight up php redirect and a double meta redirect as I'll be using these to drive traffic to some affiliate programs I'm promoting.

    Problem is I have no idea how to program this code into the server for the domain I'll be using for the redirect. Don't really have much in the way of programming experience, so I was wondering if anyone could give me a little tutorial on how to implement this strategy. I use GoDaddy if that helps at all.
     
  2. f0rked

    f0rked Registered Member

    Joined:
    Jan 25, 2009
    Messages:
    71
    Likes Received:
    64
    I'm not sure if I understand the question, but if I understand correctly, it's as simple as placing the code into a .php file, and uploading.

    example(index.php):
    PHP:
    <?php
    header
    ('Location: hxxp://xxx.redirecthere.com/');
    ?>

     
  3. rdtdtd

    rdtdtd Newbie

    Joined:
    Mar 24, 2009
    Messages:
    3
    Likes Received:
    0
    What I'm trying to accomplish is to set up a hosted image that links to a domain that will do a php redirect to my main site. I already know how to create a clickable image ad that will link to a specific domain. The thing I'm not clear on is where to upload the redirect script to to get that specific domain to redirect to my main site. Again, if it helps, I host everything through GoDaddy.
     
  4. rdtdtd

    rdtdtd Newbie

    Joined:
    Mar 24, 2009
    Messages:
    3
    Likes Received:
    0
    Better yet, I found that GoDaddy's tools will allow me to forward a domain using a 301 or 302 redirect, and it will even mask it for me. Two questions:

    1. Is this the same as doing a php redirect except I don't have to code it myself or manually upload the .php file to my server?

    2. Will GoDaddy's masking take care of problems with my AMs so I don't have to code a double-meta or use some other cloaking technique?
     
  5. drdankmendez

    drdankmendez Junior Member

    Joined:
    May 30, 2008
    Messages:
    194
    Likes Received:
    316
    Location:
    In front of my computer
    You can always check to see if your referrer is blank by creating a php file with the following code:

    Code:
    <?php
    	$refer = $_SERVER['HTTP_REFERER'];	
    	if ($refer == ''){
    		echo 'Your referrer is <strong>BLANK</strong>, congrats.';
    	} else {
    		echo 'Your referrer is <strong>'.$refer.'</strong>, try again';
    	}
    ?>
    
    Upload this file to your server and then use your redirect to go to the page. If it gives you a "your referrer is blank" message your redirect is working. If not, you will need to use a different method.

    Hope this helps.
     
    Last edited: Apr 6, 2009
  6. aReJay

    aReJay Power Member

    Joined:
    Apr 29, 2009
    Messages:
    736
    Likes Received:
    237
    Location:
    Down under
    Upload .htaccess to the root of your domain
    PHP:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule 
    (.*) insert new url here/$[R=301,L]